Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -175,10 +175,11 @@ def main():
|
|
| 175 |
st.set_page_config(page_title="Gemini 2.0 Flash Chat Q&A", layout="wide")
|
| 176 |
st.title("\U0001F4C4 Team 18 Comprehensive Prototype Using Gemini 2.0 Flash")
|
| 177 |
|
|
|
|
| 178 |
if "conversation" not in st.session_state:
|
| 179 |
st.session_state.conversation = []
|
| 180 |
if "documents_text" not in st.session_state:
|
| 181 |
-
st.session_state.documents_text =
|
| 182 |
if "chat_active" not in st.session_state:
|
| 183 |
st.session_state.chat_active = True
|
| 184 |
if "chat_history" not in st.session_state:
|
|
@@ -228,9 +229,9 @@ def main():
|
|
| 228 |
except Exception as e:
|
| 229 |
st.error(f"Failed to extract/process {uploaded_file.name}: {e}")
|
| 230 |
|
| 231 |
-
st.session_state.documents_text = all_text_content
|
| 232 |
|
| 233 |
-
# Media Capture
|
| 234 |
st.sidebar.header("Capture Media")
|
| 235 |
capture_option = st.sidebar.radio("Select Media Capture Option", ["None", "Capture Photo", "Capture Video"])
|
| 236 |
|
|
|
|
| 175 |
st.set_page_config(page_title="Gemini 2.0 Flash Chat Q&A", layout="wide")
|
| 176 |
st.title("\U0001F4C4 Team 18 Comprehensive Prototype Using Gemini 2.0 Flash")
|
| 177 |
|
| 178 |
+
# Ensure that session state variables are correctly initialized
|
| 179 |
if "conversation" not in st.session_state:
|
| 180 |
st.session_state.conversation = []
|
| 181 |
if "documents_text" not in st.session_state:
|
| 182 |
+
st.session_state.documents_text = "" # Initialize as an empty string, not a list
|
| 183 |
if "chat_active" not in st.session_state:
|
| 184 |
st.session_state.chat_active = True
|
| 185 |
if "chat_history" not in st.session_state:
|
|
|
|
| 229 |
except Exception as e:
|
| 230 |
st.error(f"Failed to extract/process {uploaded_file.name}: {e}")
|
| 231 |
|
| 232 |
+
st.session_state.documents_text += all_text_content # Append the extracted text
|
| 233 |
|
| 234 |
+
# Media Capture Section
|
| 235 |
st.sidebar.header("Capture Media")
|
| 236 |
capture_option = st.sidebar.radio("Select Media Capture Option", ["None", "Capture Photo", "Capture Video"])
|
| 237 |
|