stevafernandes commited on
Commit
e1eb3b2
·
verified ·
1 Parent(s): 9848a2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -21,9 +21,7 @@ FAISS_INDEX_PATH = os.path.join(TEMP_DIR, "faiss_index")
21
  # PDF file path
22
  PDF_FILE_PATH = "./slide.pdf"
23
 
24
- # ---- FIXED: Use the current GA embedding model ----
25
- # Legacy models (embedding-001, text-embedding-004, text-embedding-005) have
26
- # all been shut down. gemini-embedding-001 is the current GA replacement.
27
  EMBEDDING_MODEL = "models/gemini-embedding-001"
28
 
29
 
@@ -175,6 +173,8 @@ def main():
175
  st.session_state["pdf_processed"] = True
176
  st.success("PDF processed successfully. You can now ask questions.")
177
  st.rerun()
 
 
178
  except FileNotFoundError as e:
179
  st.error(str(e))
180
  st.stop()
@@ -271,6 +271,8 @@ def main():
271
  response = get_response(user_question, api_key, st.session_state["messages"])
272
  st.markdown(response)
273
  st.session_state["messages"].append({"role": "assistant", "content": response})
 
 
274
  except Exception as e:
275
  error_msg = f"Error getting answer: {str(e)}"
276
  st.error(error_msg)
 
21
  # PDF file path
22
  PDF_FILE_PATH = "./slide.pdf"
23
 
24
+ # Current GA embedding model (legacy models have been shut down)
 
 
25
  EMBEDDING_MODEL = "models/gemini-embedding-001"
26
 
27
 
 
173
  st.session_state["pdf_processed"] = True
174
  st.success("PDF processed successfully. You can now ask questions.")
175
  st.rerun()
176
+ except (st.runtime.scriptrunner.RerunException, st.runtime.scriptrunner.StopException):
177
+ raise
178
  except FileNotFoundError as e:
179
  st.error(str(e))
180
  st.stop()
 
271
  response = get_response(user_question, api_key, st.session_state["messages"])
272
  st.markdown(response)
273
  st.session_state["messages"].append({"role": "assistant", "content": response})
274
+ except (st.runtime.scriptrunner.RerunException, st.runtime.scriptrunner.StopException):
275
+ raise
276
  except Exception as e:
277
  error_msg = f"Error getting answer: {str(e)}"
278
  st.error(error_msg)