Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
|
|
|
|
|
| 1 |
from agent import run
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
def answer(question, history=None):
|
| 5 |
-
return run(question)
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
|
| 3 |
from agent import run
|
| 4 |
+
import gradio as gr
|
| 5 |
+
|
| 6 |
+
def predict(task_id, question, submitted_answer):
|
| 7 |
+
"""
|
| 8 |
+
HF evaluator calls this automatically.
|
| 9 |
+
We ignore submitted_answer and compute using run().
|
| 10 |
+
"""
|
| 11 |
+
return run(question)
|
| 12 |
+
|
| 13 |
+
with gr.Blocks() as demo:
|
| 14 |
+
gr.Markdown("# 🧠 HF Agent Evaluation Runner")
|
| 15 |
+
|
| 16 |
+
gr.Interface(
|
| 17 |
+
fn=predict,
|
| 18 |
+
inputs=[
|
| 19 |
+
gr.Textbox(label="Task ID"),
|
| 20 |
+
gr.Textbox(label="Question"),
|
| 21 |
+
gr.Textbox(label="Submitted Answer")
|
| 22 |
+
],
|
| 23 |
+
outputs=gr.Textbox(label="Final Answer")
|
| 24 |
+
)
|
| 25 |
|
| 26 |
+
demo.launch()
|
|
|
|
|
|