Imnotchis commited on
Commit
826b417
·
verified ·
1 Parent(s): e558e90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -1
app.py CHANGED
@@ -133,7 +133,24 @@ def extract_raw_text(output):
133
  return "\n".join(texts).strip()
134
 
135
  raise TypeError(f"Unsupported output type: {type(output).__name__}")
136
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
 
138
  class BasicAgent:
139
  def __init__(self):
@@ -476,6 +493,18 @@ with gr.Blocks() as demo:
476
  gr.LoginButton()
477
 
478
  run_button = gr.Button("Run Evaluation & Submit All Answers")
 
 
 
 
 
 
 
 
 
 
 
 
479
  status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
480
  # Removed max_rows=10 from DataFrame constructor
481
  results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)
 
133
  return "\n".join(texts).strip()
134
 
135
  raise TypeError(f"Unsupported output type: {type(output).__name__}")
136
+ def check_gemini_api():
137
+ try:
138
+ response = requests.get(
139
+ "https://generativelanguage.googleapis.com/v1beta/models",
140
+ headers={
141
+ "x-goog-api-key": os.environ["GEMINI_API_KEY"]
142
+ },
143
+ timeout=20
144
+ )
145
+
146
+ print("Gemini HTTP Status:", response.status_code)
147
+ print("Gemini Response:", response.text[:500])
148
+
149
+ return f"HTTP Status: {response.status_code}\n{response.text[:500]}"
150
+
151
+ except Exception as e:
152
+ print("Gemini API Error:", str(e))
153
+ return f"Error: {e}"
154
 
155
  class BasicAgent:
156
  def __init__(self):
 
493
  gr.LoginButton()
494
 
495
  run_button = gr.Button("Run Evaluation & Submit All Answers")
496
+ check_gemini_btn = gr.Button("Check Gemini API")
497
+
498
+ gemini_output = gr.Textbox(
499
+ label="Gemini API Result",
500
+ lines=6
501
+ )
502
+
503
+ check_gemini_btn.click(
504
+ fn=check_gemini_api,
505
+ inputs=[],
506
+ outputs=gemini_output
507
+ )
508
  status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
509
  # Removed max_rows=10 from DataFrame constructor
510
  results_table = gr.DataFrame(label="Questions and Agent Answers", wrap=True)