import requests import pandas as pd API_URL = "https://agents-course-unit4-scoring.hf.space/questions" def fetch_and_print_questions(): try: response = requests.get(API_URL, timeout=10) response.raise_for_status() questions = response.json() print(f" Retrieved {len(questions)} questions:\n") for q in questions: task_id = q.get("task_id") text = q.get("question") print(f"[{task_id}] {text}") # Save to CSV df = pd.DataFrame(questions) df.to_csv("gaia_questions.csv", index=False) print("\n Questions saved to gaia_questions.csv") except Exception as e: print(f" Failed to fetch questions: {e}") # Run this once manually (outside of Gradio) if __name__ == "__main__": fetch_and_print_questions()