Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 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 |
-
|
|
|
|
| 343 |
st.error("**Rate Limit Reached:** Too many requests too quickly.")
|
| 344 |
else:
|
| 345 |
-
st.error(f"API or Processing Error: {
|
|
|
|
| 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
|