Update app.py
Browse files
app.py
CHANGED
@@ -70,6 +70,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
70 |
response = requests.get(questions_url, timeout=15)
|
71 |
response.raise_for_status()
|
72 |
questions_data = response.json()
|
|
|
|
|
73 |
if not questions_data:
|
74 |
print("Fetched questions list is empty.")
|
75 |
return "Fetched questions list is empty or invalid format.", None
|
@@ -111,8 +113,12 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
111 |
submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}
|
112 |
status_update = f"Agent finished. Submitting {len(answers_payload)} answers for user '{username}'..."
|
113 |
print(status_update)
|
|
|
|
|
|
|
114 |
|
115 |
# 5. Submit
|
|
|
116 |
print(f"Submitting {len(answers_payload)} answers to: {submit_url}")
|
117 |
try:
|
118 |
response = requests.post(submit_url, json=submission_data, timeout=60)
|
@@ -154,7 +160,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
154 |
print(status_message)
|
155 |
results_df = pd.DataFrame(results_log)
|
156 |
return status_message, results_df
|
157 |
-
|
158 |
|
159 |
# --- Build Gradio Interface using Blocks ---
|
160 |
with gr.Blocks() as demo:
|
|
|
70 |
response = requests.get(questions_url, timeout=15)
|
71 |
response.raise_for_status()
|
72 |
questions_data = response.json()
|
73 |
+
# reduce the number of questions
|
74 |
+
questions_data = questions_data[:5]
|
75 |
if not questions_data:
|
76 |
print("Fetched questions list is empty.")
|
77 |
return "Fetched questions list is empty or invalid format.", None
|
|
|
113 |
submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}
|
114 |
status_update = f"Agent finished. Submitting {len(answers_payload)} answers for user '{username}'..."
|
115 |
print(status_update)
|
116 |
+
|
117 |
+
results_df = pd.DataFrame(results_log)
|
118 |
+
return status_message, results_df
|
119 |
|
120 |
# 5. Submit
|
121 |
+
"""
|
122 |
print(f"Submitting {len(answers_payload)} answers to: {submit_url}")
|
123 |
try:
|
124 |
response = requests.post(submit_url, json=submission_data, timeout=60)
|
|
|
160 |
print(status_message)
|
161 |
results_df = pd.DataFrame(results_log)
|
162 |
return status_message, results_df
|
163 |
+
"""
|
164 |
|
165 |
# --- Build Gradio Interface using Blocks ---
|
166 |
with gr.Blocks() as demo:
|