Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +6 -3
src/streamlit_app.py
CHANGED
@@ -97,12 +97,12 @@ def embed_sentence(text):
|
|
97 |
|
98 |
|
99 |
def stream_response():
|
100 |
-
for char in extract_output(response).split(" "):
|
101 |
yield char+" "
|
102 |
time.sleep(0.1) # Simulate a delay
|
103 |
|
104 |
def stream_thoughts():
|
105 |
-
for char in extract_thinking(response).split(" "):
|
106 |
yield char+" "
|
107 |
time.sleep(0.1) # Simulate a delay
|
108 |
|
@@ -170,7 +170,8 @@ if 'embeddings' not in st.session_state:
|
|
170 |
st.session_state.embeddings = None
|
171 |
if 'chunks' not in st.session_state:
|
172 |
st.session_state.chunks = None
|
173 |
-
|
|
|
174 |
# Sidebar document upload
|
175 |
st.sidebar.title("Uploading your document π")
|
176 |
uploaded_file = st.sidebar.file_uploader(
|
@@ -224,10 +225,12 @@ if generate_button:
|
|
224 |
"""
|
225 |
if st.session_state.db_transaction:
|
226 |
response=respond_chat(updated_text)
|
|
|
227 |
|
228 |
else:
|
229 |
if st.session_state.db_transaction:
|
230 |
response=respond_chat(text)
|
|
|
231 |
except Exception as e:
|
232 |
st.error(f"Error during code generation: {e}")
|
233 |
|
|
|
97 |
|
98 |
|
99 |
def stream_response():
|
100 |
+
for char in extract_output(st.session_state.response).split(" "):
|
101 |
yield char+" "
|
102 |
time.sleep(0.1) # Simulate a delay
|
103 |
|
104 |
def stream_thoughts():
|
105 |
+
for char in extract_thinking(st.session_state.response).split(" "):
|
106 |
yield char+" "
|
107 |
time.sleep(0.1) # Simulate a delay
|
108 |
|
|
|
170 |
st.session_state.embeddings = None
|
171 |
if 'chunks' not in st.session_state:
|
172 |
st.session_state.chunks = None
|
173 |
+
if 'response' not in st.session_state:
|
174 |
+
st.session_state.response=''
|
175 |
# Sidebar document upload
|
176 |
st.sidebar.title("Uploading your document π")
|
177 |
uploaded_file = st.sidebar.file_uploader(
|
|
|
225 |
"""
|
226 |
if st.session_state.db_transaction:
|
227 |
response=respond_chat(updated_text)
|
228 |
+
st.session_state.response=response
|
229 |
|
230 |
else:
|
231 |
if st.session_state.db_transaction:
|
232 |
response=respond_chat(text)
|
233 |
+
st.session_state.response=response
|
234 |
except Exception as e:
|
235 |
st.error(f"Error during code generation: {e}")
|
236 |
|