File size: 1,897 Bytes
6b4a7ef
af37df4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f7cf33f
af37df4
 
 
 
 
6b4a7ef
af37df4
 
 
 
 
 
 
 
 
 
 
 
6b4a7ef
 
af37df4
 
 
 
 
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
44
45
46
47
48
49
50
51
52
53
54
55
56
import gradio as gr
from gaia_agent import GAIAExpertAgent
from evaluation_runner import EvaluationRunner

# Инициализация компонентов
agent = GAIAExpertAgent(model_name="google/flan-t5-large")
runner = EvaluationRunner()

def run_evaluation(username: str, agent_code: str):
    """Основная функция для запуска оценки"""
    try:
        result, correct, total, df = runner.run_evaluation(
            agent=agent,
            username=username,
            agent_code=agent_code
        )
        return result, correct, total, df
    except Exception as e:
        return f"Error: {str(e)}", 0, 0, None

# Интерфейс Gradio
with gr.Blocks(title="GAIA Agent Evaluation") as demo:
    gr.Markdown("# 🏆 GAIA Agent Certification")
    
    with gr.Row():
        with gr.Column():
            gr.Markdown("### Configuration")
            username = gr.Textbox(
                label="Hugging Face Username",
                value="yoshizen"
            )
            agent_code = gr.Textbox(
                label="Agent Code",
                value="https://huggingface.co/spaces/yoshizen/FinalTest"
            )
            run_btn = gr.Button("Run Evaluation", variant="primary")
        
        with gr.Column():
            gr.Markdown("### Results")
            result_output = gr.Textbox(label="Status")
            correct_output = gr.Number(label="Correct Answers")
            total_output = gr.Number(label="Total Questions")
            results_table = gr.Dataframe(label="Details")

    run_btn.click(
        fn=run_evaluation,
        inputs=[username, agent_code],
        outputs=[result_output, correct_output, total_output, results_table]
    )

if __name__ == "__main__":
    demo.launch(
        server_name="0.0.0.0",
        server_port=7860,
        share=False  # Для Spaces оставить False
    )