Spaces:
Sleeping
Sleeping
Commit ·
bf7ae2c
1
Parent(s): 6cd9533
Update app.py
Browse files
app.py
CHANGED
|
@@ -108,6 +108,9 @@ if "initial_embeddings" not in st.session_state:
|
|
| 108 |
if "db_embeddings" not in st.session_state:
|
| 109 |
st.session_state.db_embeddings = ""
|
| 110 |
|
|
|
|
|
|
|
|
|
|
| 111 |
#if "i_file_path" not in st.session_state:
|
| 112 |
# st.session_state.i_file_path = ""
|
| 113 |
i_file_path = ""
|
|
@@ -147,8 +150,6 @@ st.markdown(
|
|
| 147 |
""", unsafe_allow_html=True
|
| 148 |
)
|
| 149 |
|
| 150 |
-
user_question = st.text_input("Enter your query here and AI-Chat with your website:")
|
| 151 |
-
|
| 152 |
text_splitter = CharacterTextSplitter(
|
| 153 |
separator = "\n",
|
| 154 |
chunk_size = 1000,
|
|
@@ -179,10 +180,14 @@ with st.sidebar:
|
|
| 179 |
st.session_state.db_embeddings = torch.FloatTensor(st.session_state.initial_embeddings)
|
| 180 |
print("DB Embeddings Ready.")
|
| 181 |
st.write("AI Chat now is ready.")
|
|
|
|
| 182 |
except Exception as e:
|
| 183 |
st.write("Unknow error.")
|
| 184 |
print("Please enter a valide URL.")
|
| 185 |
st.stop()
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
if user_question !="" and not user_question.strip().isspace() and not user_question == "" and not user_question.strip() == "" and not user_question.isspace():
|
| 188 |
with st.spinner("AI Thinking...Please wait a while to Cheers!"):
|
|
|
|
| 108 |
if "db_embeddings" not in st.session_state:
|
| 109 |
st.session_state.db_embeddings = ""
|
| 110 |
|
| 111 |
+
if "tf_switch" not in st.session_state:
|
| 112 |
+
st.session_state.tf_switch = True
|
| 113 |
+
|
| 114 |
#if "i_file_path" not in st.session_state:
|
| 115 |
# st.session_state.i_file_path = ""
|
| 116 |
i_file_path = ""
|
|
|
|
| 150 |
""", unsafe_allow_html=True
|
| 151 |
)
|
| 152 |
|
|
|
|
|
|
|
| 153 |
text_splitter = CharacterTextSplitter(
|
| 154 |
separator = "\n",
|
| 155 |
chunk_size = 1000,
|
|
|
|
| 180 |
st.session_state.db_embeddings = torch.FloatTensor(st.session_state.initial_embeddings)
|
| 181 |
print("DB Embeddings Ready.")
|
| 182 |
st.write("AI Chat now is ready.")
|
| 183 |
+
st.session_state.tf_switch=False
|
| 184 |
except Exception as e:
|
| 185 |
st.write("Unknow error.")
|
| 186 |
print("Please enter a valide URL.")
|
| 187 |
st.stop()
|
| 188 |
+
|
| 189 |
+
#user_question = st.text_input("Enter your query here and AI-Chat with website:")
|
| 190 |
+
user_question=st.text_input("Enter your query here and AI-Chat with website:",disabled=st.session_state.tf_switch)
|
| 191 |
|
| 192 |
if user_question !="" and not user_question.strip().isspace() and not user_question == "" and not user_question.strip() == "" and not user_question.isspace():
|
| 193 |
with st.spinner("AI Thinking...Please wait a while to Cheers!"):
|