[fix] streamlit app init by caching it (#1047)

This commit is contained in:
Sidharth Mohanty
2023-12-22 12:03:45 +05:30
committed by GitHub
parent dd97fad5a4
commit 6d2389de1c

View File

@@ -4,6 +4,12 @@ import streamlit as st
from embedchain import Pipeline as App
@st.cache_resource
def ec_app():
return App.from_config(config_path="config.yaml")
with st.sidebar:
huggingface_access_token = st.text_input("Hugging face Token", key="chatbot_api_key", type="password")
"[Get Hugging Face Access Token](https://huggingface.co/settings/tokens)"
@@ -34,7 +40,7 @@ if prompt := st.chat_input("Ask me anything!"):
st.stop()
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = st.session_state.chatbot_api_key
app = App.from_config(config_path="config.yaml")
app = ec_app()
if prompt.startswith("/add"):
with st.chat_message("user"):