Spaces:
Sleeping
Sleeping
File size: 1,404 Bytes
6d44864 531d209 6d44864 531d209 9fb2a9b 531d209 9fb2a9b 531d209 9fb2a9b 531d209 9fb2a9b 531d209 9fb2a9b 531d209 5465586 9fb2a9b 531d209 9fb2a9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
from datasets import load_dataset
import json
from extract_logic import run_groq_prompt
def answer_question(question):
prompt = f"""
You are a general AI assistant. Answer the question below as simply and accurately as possible. No explanations, no units, no punctuation. Just the final answer.
Question: {question}
"""
return run_groq_prompt(prompt).strip()
def generate_submission():
print("π Loading dataset...")
dataset = load_dataset("gaia-benchmark/GAIA", "2023_level1", split="validation")
subset = dataset.select(range(3)) # Keep it light for now
results = []
for example in subset:
task_id = example["task_id"]
question = example["Question"]
print(f"π Answering task: {task_id}")
try:
answer = answer_question(question)
except Exception as e:
print(f"β Error: {e}")
answer = "error"
results.append({"task_id": task_id, "model_answer": answer})
output_path = "/mnt/data/gaia_submission.jsonl"
print(f"π Writing to {output_path}...")
with open(output_path, "w", encoding="utf-8") as f:
for r in results:
f.write(json.dumps(r) + "\n")
print("File exists?", os.path.exists("/mnt/data/gaia_submission.jsonl"))
print(f"β
Done! File at {output_path}")
return output_path
if __name__ == "__main__":
generate_submission() |