I have a problem with Langchain WebBaseLoader in Streamlit. In the following control code, the webpage from the specified URL is read in 0.15 seconds.
from langchain_community.document_loaders import WebBaseLoaderimport timeloader = WebBaseLoader("https://joint-research-centre.ec.europa.eu/welcome-jec-website/reference-regulatory-framework/renewable-energy-recast-2030-red-ii_en")tic = time.perf_counter()data = loader.load()tac = time.perf_counter()print(data)print(f"Load time = {tac - tic:0.3f}.")
But, when I just initialize the Streamlit app window, the loader.load() takes 10 minutes!
import streamlit as stfrom langchain_community.document_loaders import WebBaseLoaderimport timeloader = WebBaseLoader("https://joint-research-centre.ec.europa.eu/welcome-jec-website/reference-regulatory-framework/renewable-energy-recast-2030-red-ii_en")tic = time.perf_counter()data = loader.load()tac = time.perf_counter()st.set_page_config(page_title="Test loader.load() & Streamlit", page_icon="spider")st.title(f"Load time = {tac - tic:0.3f}.")
The app opens in Firefox, iMac, osx 10.15. Does anyone have an idea what might be going on here?Cheers.
I did the same exercise with Chainlit package and it loads the data with the expected speed.I set up different localhost channels with no success.