mzabo commited on
Commit
b442094
·
verified ·
1 Parent(s): b34678b

Create view_hf_course_questions.py

Browse files
Files changed (1) hide show
  1. view_hf_course_questions.py +27 -0
view_hf_course_questions.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+
4
+ questions_url = "https://agents-course-unit4-scoring.hf.space/questions"
5
+ print(f"Fetching questions from: {questions_url}")
6
+ try:
7
+ response = requests.get(questions_url, timeout=15)
8
+ response.raise_for_status()
9
+ questions_data = response.json()
10
+ if not questions_data:
11
+ print("Fetched questions list is empty.")
12
+ else:
13
+ print(f"Fetched {len(questions_data)} questions.")
14
+ for sample in questions_data:
15
+ print("="*20)
16
+ print(f"Task ID: {sample['task_id']}")
17
+ print(f"Origin GAIA File: {sample['file_name']}")
18
+ print(f"Level: {sample['Level']}")
19
+ print(f"Question: {sample['question']}")
20
+ print("="*20)
21
+ except requests.exceptions.RequestException as e:
22
+ print(f"Error fetching questions: {e}")
23
+ except requests.exceptions.JSONDecodeError as e:
24
+ print(f"Error decoding JSON response from questions endpoint: {e}")
25
+ print(f"Response text: {response.text[:500]}")
26
+ except Exception as e:
27
+ print(f"An unexpected error occurred fetching questions: {e}")