Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,23 +52,31 @@ agent = CodeAgent(
|
|
| 52 |
prompt_templates=prompt_templates
|
| 53 |
)
|
| 54 |
|
| 55 |
-
def
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
-
# Gradio UI
|
| 59 |
-
iface = gr.
|
| 60 |
-
fn=
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 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 |
-
#
|
| 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()
|