Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -114,25 +114,28 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 114 |
print(agent_code)
|
| 115 |
|
| 116 |
# 2. Fetch Questions
|
| 117 |
-
print(
|
| 118 |
try:
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
if not questions_data:
|
| 123 |
-
|
| 124 |
-
|
|
|
|
| 125 |
print(f"Fetched {len(questions_data)} questions.")
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
|
|
|
|
|
|
| 133 |
except Exception as e:
|
| 134 |
-
print(f"An unexpected error occurred
|
| 135 |
-
return f"An unexpected error occurred
|
| 136 |
|
| 137 |
# 3. Run your Agent
|
| 138 |
results_log = []
|
|
|
|
| 114 |
print(agent_code)
|
| 115 |
|
| 116 |
# 2. Fetch Questions
|
| 117 |
+
print("Loading questions from questions.json")
|
| 118 |
try:
|
| 119 |
+
with open("questions.json", "r", encoding="utf-8") as f:
|
| 120 |
+
questions_data = json.load(f)
|
| 121 |
+
|
| 122 |
if not questions_data:
|
| 123 |
+
print("Fetched questions list is empty.")
|
| 124 |
+
return "Fetched questions list is empty or invalid format.", None
|
| 125 |
+
|
| 126 |
print(f"Fetched {len(questions_data)} questions.")
|
| 127 |
+
|
| 128 |
+
except FileNotFoundError as e:
|
| 129 |
+
print(f"Error: questions.json not found: {e}")
|
| 130 |
+
return f"Error: questions.json not found: {e}", None
|
| 131 |
+
|
| 132 |
+
except json.JSONDecodeError as e:
|
| 133 |
+
print(f"Error decoding questions.json: {e}")
|
| 134 |
+
return f"Error decoding questions.json: {e}", None
|
| 135 |
+
|
| 136 |
except Exception as e:
|
| 137 |
+
print(f"An unexpected error occurred loading questions: {e}")
|
| 138 |
+
return f"An unexpected error occurred loading questions: {e}", None
|
| 139 |
|
| 140 |
# 3. Run your Agent
|
| 141 |
results_log = []
|