Shivangsinha commited on
Commit
4e66a6c
·
verified ·
1 Parent(s): bb277bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -131,7 +131,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
131
  "Here are examples of perfect submissions:\n"
132
  "Example 1\n"
133
  "Question: What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?\n"
134
- "Answer: Vladimir\n\n"
135
  "Example 2\n"
136
  "Question: How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?\n"
137
  "Answer: 519\n\n"
@@ -159,7 +159,8 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
159
  print(f"Submitting {len(answers_payload)} answers...")
160
 
161
  try:
162
- response = requests.post(submit_url, json=submission_data, timeout=60)
 
163
  response.raise_for_status()
164
  result_data = response.json()
165
  final_status = (
@@ -169,10 +170,15 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
169
  f"Correct: {result_data.get('correct_count')}/{result_data.get('total_attempted')}\n"
170
  f"Message: {result_data.get('message')}"
171
  )
 
172
  print(final_status)
 
173
  return final_status, pd.DataFrame(results_log)
174
  except Exception as e:
175
- return f"Submission failed: {e}", pd.DataFrame(results_log)
 
 
 
176
 
177
  # --- Build Gradio UI ---
178
  with gr.Blocks() as demo:
 
131
  "Here are examples of perfect submissions:\n"
132
  "Example 1\n"
133
  "Question: What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?\n"
134
+ "Answer: Claus\n\n"
135
  "Example 2\n"
136
  "Question: How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?\n"
137
  "Answer: 519\n\n"
 
159
  print(f"Submitting {len(answers_payload)} answers...")
160
 
161
  try:
162
+ # INCREASED TIMEOUT TO 300 SECONDS (5 Minutes) to allow the scoring server to wake up!
163
+ response = requests.post(submit_url, json=submission_data, timeout=300)
164
  response.raise_for_status()
165
  result_data = response.json()
166
  final_status = (
 
170
  f"Correct: {result_data.get('correct_count')}/{result_data.get('total_attempted')}\n"
171
  f"Message: {result_data.get('message')}"
172
  )
173
+ print("\n" + "="*40)
174
  print(final_status)
175
+ print("="*40 + "\n")
176
  return final_status, pd.DataFrame(results_log)
177
  except Exception as e:
178
+ # ADDED PRINT STATEMENT so you can actually see the error in the logs!
179
+ error_msg = f"Submission failed: {e}"
180
+ print(f"\n🚨 {error_msg} 🚨\n")
181
+ return error_msg, pd.DataFrame(results_log)
182
 
183
  # --- Build Gradio UI ---
184
  with gr.Blocks() as demo: