ressay1973 commited on
Commit
61ab4fc
·
verified ·
1 Parent(s): 6db9175

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -16
app.py CHANGED
@@ -52,23 +52,31 @@ agent = CodeAgent(
52
  prompt_templates=prompt_templates
53
  )
54
 
55
- def ui_diagnose_incident(service_criticity, disruption, affectation_time, magnitude, workaround):
56
- return diagnose_incident(service_criticity, disruption, affectation_time, magnitude, workaround)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
- # Gradio UI for testing
59
- iface = gr.Interface(
60
- fn=ui_diagnose_incident,
61
- inputs=[
62
- gr.Dropdown(["High", "Low"], label="Service Criticity"),
63
- gr.Dropdown(["Full", "Degraded", "None"], label="Disruption"),
64
- gr.Dropdown(["Up 15 mins", "Less 15 mins"], label="Affectation Time"),
65
- gr.Dropdown(["High", "Low", "None"], label="Magnitude"),
66
- gr.Dropdown(["Yes", "No"], label="Is there any business workaround?")
67
- ],
68
- outputs=gr.Textbox(label="Incident Priority"),
69
- title="Incident Severity Classifier",
70
- description="Select the incident parameters and get the classification priority."
71
  )
72
 
73
- # Launch UI
74
  iface.launch()
 
52
  prompt_templates=prompt_templates
53
  )
54
 
55
+ def chat_diagnose_incident(conversation):
56
+ """Simulates a conversation with the agent to diagnose an incident."""
57
+
58
+ conversation.append("Agent: Hola, cuéntame qué ocurrió con el servicio.")
59
+ service_criticity = gr.Textbox(label="Tu respuesta")
60
+ conversation.append("Agent: ¿El problema causa una interrupción total o solo degradación del servicio?")
61
+ disruption = gr.Textbox(label="Tu respuesta")
62
+ conversation.append("Agent: ¿Cuánto tiempo lleva afectado?")
63
+ affectation_time = gr.Textbox(label="Tu respuesta")
64
+ conversation.append("Agent: ¿Qué tan grave es el impacto en el sistema?")
65
+ magnitude = gr.Textbox(label="Tu respuesta")
66
+ conversation.append("Agent: ¿Existe algún tipo de solución alternativa o workaround?")
67
+ workaround = gr.Textbox(label="Tu respuesta")
68
+
69
+ priority = diagnose_incident(service_criticity, disruption, affectation_time, magnitude, workaround)
70
+ conversation.append(f"Agent: Con base en la información, el incidente se clasifica como prioridad {priority}.")
71
+ return "\n".join(conversation)
72
 
73
+ # Gradio UI para conversación
74
+ iface = gr.ChatInterface(
75
+ fn=chat_diagnose_incident,
76
+ title="Asistente de Diagnóstico de Incidentes",
77
+ description="Conversación interactiva con el agente para clasificar la severidad del incidente.",
78
+ theme="dark"
 
 
 
 
 
 
 
79
  )
80
 
81
+ # Lanzar UI
82
  iface.launch()