import requests from agent import agent # Imports the agent function from agent.py HF_USERNAME = "wowpixels" # Replace with your actual HF username CODE_LINK = "https://huggingface.co/spaces/wowpixels/Perfume-recommender-agent/tree/main" BASE_URL = "https://gaia.evaluation.huggingface.co" GET_RANDOM_QUESTION = f"{BASE_URL}/random-question" SUBMIT_ANSWER = f"{BASE_URL}/submit" def main(): print("🔍 Fetching a random GAIA evaluation question...") try: res = requests.get(GET_RANDOM_QUESTION) res.raise_for_status() except Exception as e: print("❌ Failed to fetch GAIA question:", e) return question_obj = res.json() task_id = question_obj["task_id"] question = question_obj["question"] print(f"📝 Task ID: {task_id}") print(f"💬 Question: {question}") try: answer = agent(question) except Exception as e: print("❌ Agent failed to produce answer:", e) return print(f"✅ Answer: {answer}") payload = { "username": HF_USERNAME, "agent_code": CODE_LINK, "answers": [ { "task_id": task_id, "submitted_answer": answer } ] } print("📤 Submitting answer...") try: submit_res = requests.post(SUBMIT_ANSWER, json=payload) submit_res.raise_for_status() print("🏆 Submitted successfully!") print("🎯 Response:", submit_res.json()) except Exception as e: print("❌ Submission failed:", e) if __name__ == "__main__": main()