CoolFace
Apppublic

dschandra/agent_behavior_app

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes
app.py30 linesDownload Raw Back to root
1import gradio as gr2from model.anomaly_detector import detect_anomaly_plain_text3 4def predict(agent_id, weekly_calls, missed_visits, travel_distance, lead_drop_rate):5    input_data = {6        "agent_id": agent_id,7        "weekly_calls": weekly_calls,8        "missed_visits": missed_visits,9        "travel_distance": travel_distance,10        "lead_drop_rate": lead_drop_rate11    }12    return detect_anomaly_plain_text(input_data)13 14iface = gr.Interface(15    fn=predict,16    inputs=[17        gr.Textbox(label="Agent ID", placeholder="e.g., AG1541"),18        gr.Slider(0, 20, step=1, label="Weekly Calls"),19        gr.Slider(0, 20, step=1, label="Missed Visits"),20        gr.Slider(0, 100, step=1, label="Travel Distance (km)"),21        gr.Slider(0.0, 1.0, step=0.01, label="Lead Drop Rate")22    ],23    outputs=gr.Textbox(label="Analysis Result"),24    title="Agent Behavior Anomaly Detector",25    description="Detects anomalies in agent behavior and provides reason in plain English."26)27 28if __name__ == "__main__":29    iface.launch()30