ressay1973 commited on
Commit
69dfb5c
·
verified ·
1 Parent(s): 25c8f8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -36
app.py CHANGED
@@ -3,14 +3,10 @@ import datetime
3
  import requests
4
  import pytz
5
  import yaml
6
-
7
  from tools.final_answer import FinalAnswerTool
8
  from Gradio_UI import GradioUI
9
 
10
- # Herramienta para clasificar alertas P1, P2, P3 basado en criterios de la tabla
11
-
12
-
13
-
14
  @tool
15
  def classify_alert(service_criticity: str, disruption: str, affectation_time: str, magnitude: str, business_workaround: str) -> str:
16
  """Clasifica una alerta en P1, P2 o P3 según los criterios especificados.
@@ -28,11 +24,7 @@ def classify_alert(service_criticity: str, disruption: str, affectation_time: st
28
  else:
29
  return "P3 - Menor"
30
 
31
-
32
-
33
-
34
-
35
- # Herramienta para generar resúmenes de reportes de infraestructura
36
  @tool
37
  def summarize_report(report_text: str) -> str:
38
  """Genera un resumen de un reporte sobre la infraestructura de la plataforma.
@@ -49,38 +41,23 @@ def summarize_report(report_text: str) -> str:
49
  else:
50
  return "Error al generar el resumen."
51
 
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
- final_answer = FinalAnswerTool()
72
-
73
- custom_role_conversions=None,
74
  )
75
 
76
- image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
 
 
77
 
78
- with open("prompts.yaml", 'r') as stream:
 
79
  prompt_templates = yaml.safe_load(stream)
80
 
81
  agent = CodeAgent(
82
  model=model,
83
- tools=[final_answer, classify_alert, summarize_report],
84
  max_steps=6,
85
  verbosity_level=1,
86
  grammar=None,
@@ -90,4 +67,4 @@ agent = CodeAgent(
90
  prompt_templates=prompt_templates
91
  )
92
 
93
- GradioUI(agent).launch()
 
3
  import requests
4
  import pytz
5
  import yaml
 
6
  from tools.final_answer import FinalAnswerTool
7
  from Gradio_UI import GradioUI
8
 
9
+ # Herramienta para clasificar alertas P1, P2, P3 basado en criterios de la tabla
 
 
 
10
  @tool
11
  def classify_alert(service_criticity: str, disruption: str, affectation_time: str, magnitude: str, business_workaround: str) -> str:
12
  """Clasifica una alerta en P1, P2 o P3 según los criterios especificados.
 
24
  else:
25
  return "P3 - Menor"
26
 
27
+ # Herramienta para generar resúmenes de reportes de infraestructura
 
 
 
 
28
  @tool
29
  def summarize_report(report_text: str) -> str:
30
  """Genera un resumen de un reporte sobre la infraestructura de la plataforma.
 
41
  else:
42
  return "Error al generar el resumen."
43
 
44
+ # Definir el modelo
45
+ model = HfApiModel(
46
+ model_name="meta-llama/Llama-2-13b-chat-hf",
47
+ api_key="YOUR_HF_API_KEY"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  )
49
 
50
+ final_answer = FinalAnswerTool()
51
+
52
+ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
53
 
54
+ # Cargar plantillas de prompts
55
+ with open("prompts.yaml", 'r') as stream:
56
  prompt_templates = yaml.safe_load(stream)
57
 
58
  agent = CodeAgent(
59
  model=model,
60
+ tools=[final_answer, classify_alert, summarize_report, image_generation_tool],
61
  max_steps=6,
62
  verbosity_level=1,
63
  grammar=None,
 
67
  prompt_templates=prompt_templates
68
  )
69
 
70
+ GradioUI(agent).launch()