NKessler commited on
Commit
6978218
·
verified ·
1 Parent(s): abe4f2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -27,7 +27,7 @@ GEMINI_API_KEY = os.environ.get("GEMINI_API_KEY")
27
  if GEMINI_API_KEY:
28
  genai.configure(api_key=GEMINI_API_KEY)
29
 
30
- ai_model = genai.GenerativeModel('gemini-2.5-pro')
31
 
32
  def _truncate_to_words(text: str, limit: int) -> str:
33
  """Truncates text by word count."""
@@ -327,7 +327,10 @@ if st.button("Analyze and Compare Sources", use_container_width=True, type="prim
327
  st.session_state.results_b = future_b.result()
328
  st.session_state.nli_result = future_nli.result()
329
  except Exception as e:
330
- st.error(f"API or Processing Error: {str(e)}")
 
 
 
331
  st.session_state.results_a = None
332
  st.session_state.results_b = None
333
  st.session_state.nli_result = None
 
27
  if GEMINI_API_KEY:
28
  genai.configure(api_key=GEMINI_API_KEY)
29
 
30
+ ai_model = genai.GenerativeModel('gemini-2.5-flash')
31
 
32
  def _truncate_to_words(text: str, limit: int) -> str:
33
  """Truncates text by word count."""
 
327
  st.session_state.results_b = future_b.result()
328
  st.session_state.nli_result = future_nli.result()
329
  except Exception as e:
330
+ if "429" in str(e) or "RESOURCE_EXHAUSTED" in str(e):
331
+ st.error("**Rate Limit Reached:** Too many requests too quickly.")
332
+ else:
333
+ st.error(f"API or Processing Error: {str(e)}")
334
  st.session_state.results_a = None
335
  st.session_state.results_b = None
336
  st.session_state.nli_result = None