File size: 1,235 Bytes
89484e8
041e519
8d30529
041e519
8d30529
041e519
 
 
8d30529
041e519
8d30529
 
041e519
 
8d30529
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import os
import requests

# 🔐 Load token and model ID
HF_TOKEN = os.getenv("HF_TOKEN")
MODEL_ID = "SlavkoSystems/SlavkoScore-v1"

# 🧠 SlavkoScore™ evaluator (fallback ako nema tokena)
def evaluate_agent(prompt):
    if not HF_TOKEN:
        return f"(Fallback mode) Received prompt: {prompt}"
    headers = {"Authorization": f"Bearer {HF_TOKEN}"}
    payload = {"inputs": prompt}
    try:
        response = requests.post(
            f"https://api-inference.huggingface.co/models/{MODEL_ID}",
            headers=headers,
            json=payload
        )
        return response.json().get("generated_text", "No response")
    except Exception as e:
        return f"Error during evaluation: {str(e)}"

# 🧱 UI layout
with gr.Blocks() as demo:
    gr.Markdown("# 🧠 SlavkoAgent-Dashboard")
    gr.Markdown("Evaluate agent prompts using the SlavkoScore™ protocol.")

    with gr.Column():
        prompt = gr.Textbox(label="Agent Prompt", placeholder="Enter agent behavior or transcript...")
        output = gr.Textbox(label="SlavkoScore™ Evaluation")
        submit = gr.Button("Evaluate")
        submit.click(fn=evaluate_agent, inputs=prompt, outputs=output)

# 🚀 Launch app
demo.launch()