Spaces:
Runtime error
Runtime error
Download app.py from SlavkoSystems/SlavkoAgent-Dashboard: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/spaces/SlavkoSystems/SlavkoAgent-Dashboard/resolve/main/app.py
- Command line
-
hf download hf://spaces/SlavkoSystems/SlavkoAgent-Dashboard/app.py
-
curl -L -o app.py https://huggingface.co/spaces/SlavkoSystems/SlavkoAgent-Dashboard/resolve/main/app.py
1.24 kB
| 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() | |