notsakeeb commited on
Commit
2d2cb40
·
verified ·
1 Parent(s): f7c7c33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -18
app.py CHANGED
@@ -100,24 +100,28 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
100
 
101
  # 2. Fetch Questions
102
  print(f"Fetching questions from: {questions_url}")
103
- try:
104
- response = requests.get(questions_url, timeout=15)
105
- response.raise_for_status()
106
- questions_data = response.json()
107
- if not questions_data:
108
- print("Fetched questions list is empty.")
109
- return "Fetched questions list is empty or invalid format.", None
110
- print(f"Fetched {len(questions_data)} questions.")
111
- except requests.exceptions.RequestException as e:
112
- print(f"Error fetching questions: {e}")
113
- return f"Error fetching questions: {e}", None
114
- except requests.exceptions.JSONDecodeError as e:
115
- print(f"Error decoding JSON response from questions endpoint: {e}")
116
- print(f"Response text: {response.text[:500]}")
117
- return f"Error decoding server response for questions: {e}", None
118
- except Exception as e:
119
- print(f"An unexpected error occurred fetching questions: {e}")
120
- return f"An unexpected error occurred fetching questions: {e}", None
 
 
 
 
121
 
122
  # 3. Run your Agent
123
  results_log = []
 
100
 
101
  # 2. Fetch Questions
102
  print(f"Fetching questions from: {questions_url}")
103
+ # try:
104
+ # response = requests.get(questions_url, timeout=15)
105
+ # response.raise_for_status()
106
+ # questions_data = response.json()
107
+ # if not questions_data:
108
+ # print("Fetched questions list is empty.")
109
+ # return "Fetched questions list is empty or invalid format.", None
110
+ # print(f"Fetched {len(questions_data)} questions.")
111
+ # except requests.exceptions.RequestException as e:
112
+ # print(f"Error fetching questions: {e}")
113
+ # return f"Error fetching questions: {e}", None
114
+ # except requests.exceptions.JSONDecodeError as e:
115
+ # print(f"Error decoding JSON response from questions endpoint: {e}")
116
+ # print(f"Response text: {response.text[:500]}")
117
+ # return f"Error decoding server response for questions: {e}", None
118
+ # except Exception as e:
119
+ # print(f"An unexpected error occurred fetching questions: {e}")
120
+ # return f"An unexpected error occurred fetching questions: {e}", None
121
+
122
+ with open('questions.json') as f:
123
+ d = json.load(f)
124
+ questions_data = d
125
 
126
  # 3. Run your Agent
127
  results_log = []