NKessler commited on
Commit
b928855
·
verified ·
1 Parent(s): a841cfc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -328,21 +328,19 @@ if execute_analysis:
328
  st.error("One of the URLs could not be scraped. Please copy and paste the text directly.")
329
 
330
  else:
331
- with st.spinner("Analyzing framing semantics for both sources."):
332
  try:
333
- with concurrent.futures.ThreadPoolExecutor() as executor:
334
- future_a = executor.submit(analyze_article, text_a_clean)
335
- future_b = executor.submit(analyze_article, text_b_clean)
336
- future_nli = executor.submit(check_contradiction, text_a_clean, text_b_clean)
337
-
338
- st.session_state.results_a = future_a.result()
339
- st.session_state.results_b = future_b.result()
340
- st.session_state.nli_result = future_nli.result()
341
  except Exception as e:
342
- if "429" in str(e) or "RESOURCE_EXHAUSTED" in str(e):
 
343
  st.error("**Rate Limit Reached:** Too many requests too quickly.")
344
  else:
345
- st.error(f"API or Processing Error: {str(e)}")
 
346
  st.session_state.results_a = None
347
  st.session_state.results_b = None
348
  st.session_state.nli_result = None
 
328
  st.error("One of the URLs could not be scraped. Please copy and paste the text directly.")
329
 
330
  else:
331
+ with st.spinner("Analyzing framing semantics for both sources (this takes a few seconds)..."):
332
  try:
333
+ st.session_state.results_a = analyze_article(text_a_clean)
334
+ st.session_state.results_b = analyze_article(text_b_clean)
335
+ st.session_state.nli_result = check_contradiction(text_a_clean, text_b_clean)
336
+
 
 
 
 
337
  except Exception as e:
338
+ error_msg = str(e)
339
+ if "429" in error_msg or "RESOURCE_EXHAUSTED" in error_msg:
340
  st.error("**Rate Limit Reached:** Too many requests too quickly.")
341
  else:
342
+ st.error(f"API or Processing Error: {error_msg}")
343
+
344
  st.session_state.results_a = None
345
  st.session_state.results_b = None
346
  st.session_state.nli_result = None