Sayandip commited on
Commit
cfd0b04
·
verified ·
1 Parent(s): cb47b15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -87,12 +87,15 @@ def main():
87
  st.set_page_config(page_title="Gemini Chat QA", layout="wide")
88
  st.title("📄 Chat with Your Document using Gemini (Sayandip+Dhiraj+Fazal)")
89
 
 
90
  if "conversation" not in st.session_state:
91
  st.session_state.conversation = []
92
  if "document_text" not in st.session_state:
93
  st.session_state.document_text = ""
94
  if "chat_active" not in st.session_state:
95
  st.session_state.chat_active = True
 
 
96
 
97
  uploaded_file = st.file_uploader(
98
  "Upload a file (.txt, .docx, .csv, .xlsx, .pptx, .pdf, .html, .htm, .tex, .jpg, .jpeg, .png):",
 
87
  st.set_page_config(page_title="Gemini Chat QA", layout="wide")
88
  st.title("📄 Chat with Your Document using Gemini (Sayandip+Dhiraj+Fazal)")
89
 
90
+ # Initialize session state attributes if they don't exist
91
  if "conversation" not in st.session_state:
92
  st.session_state.conversation = []
93
  if "document_text" not in st.session_state:
94
  st.session_state.document_text = ""
95
  if "chat_active" not in st.session_state:
96
  st.session_state.chat_active = True
97
+ if "chat_history" not in st.session_state: # Initialize chat_history
98
+ st.session_state.chat_history = []
99
 
100
  uploaded_file = st.file_uploader(
101
  "Upload a file (.txt, .docx, .csv, .xlsx, .pptx, .pdf, .html, .htm, .tex, .jpg, .jpeg, .png):",