Vlytz commited on
Commit
15b1ba5
·
verified ·
1 Parent(s): 458fd73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -91,10 +91,12 @@ with gr.Blocks(theme=gr.themes.Soft(), title="Tutor Virtual") as demo:
91
 
92
  gr.Markdown("*(Nota: El puntaje de riesgo cambiará si las notas son < 4.0)*")
93
 
 
94
  # --- Columna 2: El "Chat" (Área Principal) ---
95
  with gr.Column(scale=4):
96
  gr.ChatInterface(
97
  fn=chatbot_response,
 
98
 
99
  chatbot=gr.Chatbot(
100
  height=500,
@@ -105,19 +107,16 @@ with gr.Blocks(theme=gr.themes.Soft(), title="Tutor Virtual") as demo:
105
 
106
  textbox=gr.Textbox(placeholder="Hola, ¿en qué puedo ayudarte hoy?"),
107
  submit_btn="Enviar Consulta",
108
-
109
- # clear_btn="Limpiar Chat", # <--- 4. BORRA ESTA LÍNEA TAMBIÉN
110
-
111
  additional_inputs=[input_edad, input_sexo, input_asistencia, input_notas]
112
  )
113
 
 
 
114
  # --- 5. Montar y Lanzar (La Magia) ---
115
- # Esto le dice a Gradio que también sirva la API de FastAPI
116
- # en la ruta "/api"
117
- # 1. Monta tu 'fastapi_app' DENTRO de tu 'demo' en la ruta "/api"
118
- demo.mount("/api", fastapi_app)
119
 
120
- # 2. La variable 'app' que Hugging Face debe ejecutar es 'demo'
121
- app = demo
 
 
122
  # NOTA: No uses demo.launch().
123
- # Hugging Face usará la variable 'app' para lanzar el servidor.
 
91
 
92
  gr.Markdown("*(Nota: El puntaje de riesgo cambiará si las notas son < 4.0)*")
93
 
94
+ # --- Columna 2: El "Chat" (Área Principal) ---
95
  # --- Columna 2: El "Chat" (Área Principal) ---
96
  with gr.Column(scale=4):
97
  gr.ChatInterface(
98
  fn=chatbot_response,
99
+ type="messages", # <--- 1. AÑADE ESTO (para el Warning)
100
 
101
  chatbot=gr.Chatbot(
102
  height=500,
 
107
 
108
  textbox=gr.Textbox(placeholder="Hola, ¿en qué puedo ayudarte hoy?"),
109
  submit_btn="Enviar Consulta",
 
 
 
110
  additional_inputs=[input_edad, input_sexo, input_asistencia, input_notas]
111
  )
112
 
113
+ # ... (más abajo) ...
114
+
115
  # --- 5. Montar y Lanzar (La Magia) ---
 
 
 
 
116
 
117
+ # ¡Esta es la sintaxis correcta para Gradio 4.0+!
118
+ # Vuelve a usar 'gr.mount_app'
119
+ app = gr.mount_app(demo, fastapi_app, path="/api")
120
+
121
  # NOTA: No uses demo.launch().
122
+ # Hugging Face usará la variable 'app' para lanzar el se