From 07b9a4222bab8128a5dcceca985fb17db0c98e05 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 29 Mar 2026 09:33:39 +0200 Subject: Show gemini error in result --- server.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server.py b/server.py index 06f109b..46cd347 100755 --- a/server.py +++ b/server.py @@ -1598,6 +1598,7 @@ def sentences(): pmid_list.append(pmid+cat0) # Step 2: If the category is 'stress' and we have sentences, perform batch classification + gemini_error = None if cat0 == 'stress' and all_stress_sentences: if not GEMINI_API_KEY: print("Gemini API key not configured. Skipping batch classification.") @@ -1640,7 +1641,8 @@ Here are the sentences to classify: out_pos += s_obj['html_line'] except Exception as e: - print(f"Error during batch Gemini classification: {e}") + gemini_error = str(e) + print(f"Error during batch Gemini classification: {gemini_error}") out1="
Gemini API error: {gemini_error}
" + else: + error_html = "" if(out_neg == "" and out_pos == ""): # If no classification results, show all sentences if any, or a message if out3: - out= out1+ out2 + "All related sentences (Gemini classification not available or no specific stress types found):