Update app.py
Browse files
app.py
CHANGED
|
@@ -1,110 +1,230 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import json
|
| 3 |
-
import os
|
| 4 |
import datetime
|
| 5 |
import random
|
|
|
|
|
|
|
|
|
|
| 6 |
from registro import guardar_registro, cargar_registro
|
| 7 |
from chatbot_nuti import buscar_respuesta
|
| 8 |
from optimizacion import resize_imagen, cargar_modelo_ligero, cache_resultado
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
USUARIOS_FILE = "usuarios.json"
|
| 12 |
SESION_FILE = "sesion.json"
|
| 13 |
|
| 14 |
-
def
|
| 15 |
-
if os.path.exists(
|
| 16 |
-
with open(
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
json.dump(data,f,indent=4)
|
| 23 |
-
|
| 24 |
-
def registrar_usuario(nombre,email,password):
|
| 25 |
-
usuarios = cargar_usuarios()
|
| 26 |
-
if email in usuarios:
|
| 27 |
-
return "⚠️ Ya existe una cuenta con ese correo."
|
| 28 |
-
usuarios[email] = {"nombre": nombre,"password": password}
|
| 29 |
-
guardar_usuarios(usuarios)
|
| 30 |
-
return "✅ Registro exitoso. ¡Ahora puedes iniciar sesión!"
|
| 31 |
-
|
| 32 |
-
def iniciar_sesion(email,password):
|
| 33 |
-
usuarios = cargar_usuarios()
|
| 34 |
-
if email not in usuarios:
|
| 35 |
-
return "❌ Usuario no encontrado.", False, ""
|
| 36 |
-
if usuarios[email]["password"] != password:
|
| 37 |
-
return "🔐 Contraseña incorrecta.", False, ""
|
| 38 |
-
# Guardar sesión
|
| 39 |
-
with open(SESION_FILE,"w") as f:
|
| 40 |
-
json.dump({"usuario": email,"nombre": usuarios[email]["nombre"]}, f)
|
| 41 |
-
return f"✅ Bienvenido de nuevo, {usuarios[email]['nombre']}!", True, usuarios[email]['nombre']
|
| 42 |
-
|
| 43 |
-
# ---- Estado ----
|
| 44 |
estado = cargar_registro()
|
| 45 |
-
for k,v in {
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
| 47 |
|
|
|
|
| 48 |
modelo = cargar_modelo_ligero()
|
| 49 |
|
| 50 |
-
#
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
def calcular_calorias(edad, peso, altura, sexo, actividad):
|
| 53 |
-
if sexo.lower()=="hombre":
|
| 54 |
-
bmr = 88.36 + (13.4*peso) + (4.8*altura) - (5.7*edad)
|
| 55 |
else:
|
| 56 |
-
bmr = 447.6 + (9.2*peso) + (3.1*altura) - (4.3*edad)
|
| 57 |
-
niveles = {"Sedentario":1.2,"Ligero":1.375,"Moderado":1.55,"Activo":1.725,"Muy activo":1.9}
|
| 58 |
-
tdee = bmr * niveles.get(actividad,1.2)
|
| 59 |
estado["meta_diaria"] = round(tdee)
|
| 60 |
estado["restantes"] = round(tdee)
|
| 61 |
guardar_registro(estado)
|
| 62 |
return f"🔥 Tu meta calórica diaria es de {round(tdee)} cal."
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
with gr.Blocks() as demo:
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
gr.Markdown("**Registro:**")
|
| 73 |
-
nombre_reg = gr.Textbox(label="Nombre completo")
|
| 74 |
-
email_reg = gr.Textbox(label="Correo electrónico")
|
| 75 |
-
pass_reg = gr.Textbox(label="Contraseña", type="password")
|
| 76 |
-
salida_reg = gr.Textbox(label="Resultado")
|
| 77 |
-
btn_reg = gr.Button("Crear cuenta")
|
| 78 |
-
btn_reg.click(registrar_usuario, inputs=[nombre_reg,email_reg,pass_reg], outputs=salida_reg)
|
| 79 |
-
|
| 80 |
-
gr.Markdown("**Iniciar sesión:**")
|
| 81 |
email_login = gr.Textbox(label="Correo electrónico")
|
| 82 |
pass_login = gr.Textbox(label="Contraseña", type="password")
|
| 83 |
salida_login = gr.Textbox(label="Mensaje")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
btn_login = gr.Button("Entrar")
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
with gr.Tab("🧍 Tu perfil"):
|
| 91 |
edad = gr.Number(label="Edad (años)")
|
| 92 |
peso = gr.Number(label="Peso (kg)")
|
| 93 |
altura = gr.Number(label="Altura (cm)")
|
| 94 |
-
sexo = gr.Radio(["Hombre","Mujer"], label="Sexo")
|
| 95 |
-
actividad = gr.Dropdown(["Sedentario","Ligero","Moderado","Activo","Muy activo"], label="Nivel de actividad")
|
| 96 |
btn_meta = gr.Button("Calcular meta calórica")
|
| 97 |
salida_meta = gr.Textbox(label="Resultado")
|
| 98 |
-
btn_meta.click(calcular_calorias, inputs=[edad,peso,altura,sexo,actividad], outputs=salida_meta)
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
import datetime
|
| 3 |
import random
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
from login import iniciar_sesion, registrar_usuario
|
| 7 |
from registro import guardar_registro, cargar_registro
|
| 8 |
from chatbot_nuti import buscar_respuesta
|
| 9 |
from optimizacion import resize_imagen, cargar_modelo_ligero, cache_resultado
|
| 10 |
|
| 11 |
+
# ---------------- SESIÓN ----------------
|
|
|
|
| 12 |
SESION_FILE = "sesion.json"
|
| 13 |
|
| 14 |
+
def obtener_usuario_actual():
|
| 15 |
+
if os.path.exists(SESION_FILE):
|
| 16 |
+
with open(SESION_FILE, "r") as f:
|
| 17 |
+
data = json.load(f)
|
| 18 |
+
return data.get("usuario", None)
|
| 19 |
+
return None
|
| 20 |
+
|
| 21 |
+
# ---------------- ESTADO ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
estado = cargar_registro()
|
| 23 |
+
for k, v in {
|
| 24 |
+
"meta_diaria": 0, "restantes": 0, "quemas": 0, "puntos": 0,
|
| 25 |
+
"registro": [], "badges": [], "emocion": "", "nivel": 1
|
| 26 |
+
}.items():
|
| 27 |
+
estado.setdefault(k, v)
|
| 28 |
|
| 29 |
+
# ---------------- MODELO ----------------
|
| 30 |
modelo = cargar_modelo_ligero()
|
| 31 |
|
| 32 |
+
# ---------------- DATOS ----------------
|
| 33 |
+
calorias_promedio = {
|
| 34 |
+
"pizza": 285, "hamburger": 354, "apple": 95, "banana": 105,
|
| 35 |
+
"salad": 150, "pasta": 350, "rice": 200, "ice cream": 210,
|
| 36 |
+
"donut": 195, "fish": 206, "chicken": 239, "broccoli": 55
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
actividades = {
|
| 40 |
+
"Correr": 700, "Caminar": 250, "Fútbol": 600,
|
| 41 |
+
"Natación": 550, "Básquetbol": 500, "Voleibol": 400, "Yoga": 200,
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
nutriologos = [
|
| 45 |
+
{"nombre": "Dra. Ana López", "pais": "México", "estado": "Sonora", "ciudad": "Hermosillo",
|
| 46 |
+
"especialidad": "Nutrición deportiva", "direccion": "Av. Universidad 200", "contacto": "Instagram: @dra.analpz"},
|
| 47 |
+
{"nombre": "Lic. Jorge Ramírez", "pais": "México", "estado": "CDMX", "ciudad": "Coyoacán",
|
| 48 |
+
"especialidad": "Control de peso", "direccion": "Centro NutriVida, Av. Pacífico 300", "contacto": "Tel: +52 55 1234 5678"},
|
| 49 |
+
{"nombre": "Dra. Camila Torres", "pais": "Colombia", "estado": "Antioquia", "ciudad": "Medellín",
|
| 50 |
+
"especialidad": "Nutrición infantil", "direccion": "Cra 40 #23", "contacto": "Email: camilatorresnutri@gmail.com"},
|
| 51 |
+
{"nombre": "Dr. Luis Fernández", "pais": "España", "estado": "Madrid", "ciudad": "Madrid",
|
| 52 |
+
"especialidad": "Nutrición clínica", "direccion": "Calle Mayor 45", "contacto": "Web: www.drfernandez.es"},
|
| 53 |
+
{"nombre": "Lic. Sofía Rivera", "pais": "México", "estado": "Jalisco", "ciudad": "Guadalajara",
|
| 54 |
+
"especialidad": "Nutrición general y recetas personalizadas", "direccion": "Av. Chapultepec 100", "contacto": "IG: @sofiariveranutri"},
|
| 55 |
+
]
|
| 56 |
+
|
| 57 |
+
misiones = [
|
| 58 |
+
"🥤 Bebe 8 vasos de agua.",
|
| 59 |
+
"🍎 Come 3 frutas distintas.",
|
| 60 |
+
"🚶 Camina 20 minutos.",
|
| 61 |
+
"🌈 Come 4 colores de comida diferentes.",
|
| 62 |
+
"🧘 Haz 10 minutos de respiración o yoga."
|
| 63 |
+
]
|
| 64 |
+
|
| 65 |
+
# ---------------- FUNCIONES ----------------
|
| 66 |
def calcular_calorias(edad, peso, altura, sexo, actividad):
|
| 67 |
+
if sexo.lower() == "hombre":
|
| 68 |
+
bmr = 88.36 + (13.4 * peso) + (4.8 * altura) - (5.7 * edad)
|
| 69 |
else:
|
| 70 |
+
bmr = 447.6 + (9.2 * peso) + (3.1 * altura) - (4.3 * edad)
|
| 71 |
+
niveles = {"Sedentario": 1.2, "Ligero": 1.375, "Moderado": 1.55, "Activo": 1.725, "Muy activo": 1.9}
|
| 72 |
+
tdee = bmr * niveles.get(actividad, 1.2)
|
| 73 |
estado["meta_diaria"] = round(tdee)
|
| 74 |
estado["restantes"] = round(tdee)
|
| 75 |
guardar_registro(estado)
|
| 76 |
return f"🔥 Tu meta calórica diaria es de {round(tdee)} cal."
|
| 77 |
|
| 78 |
+
def analizar_foto(img):
|
| 79 |
+
if estado["meta_diaria"] == 0:
|
| 80 |
+
return "⚠️ Primero calcula tu meta diaria."
|
| 81 |
+
img_opt = resize_imagen(img)
|
| 82 |
+
resultado = cache_resultado(str(img_opt.tobytes()), modelo, img_opt)
|
| 83 |
+
nombre = resultado[0]['label'].lower()
|
| 84 |
+
calorias = calorias_promedio.get(nombre, 250)
|
| 85 |
+
estado["restantes"] = max(0, estado["restantes"] - calorias)
|
| 86 |
+
estado["registro"].append({
|
| 87 |
+
"fecha": str(datetime.datetime.now()), "tipo": "comida",
|
| 88 |
+
"nombre": nombre, "calorias": calorias
|
| 89 |
+
})
|
| 90 |
+
estado["puntos"] += 10
|
| 91 |
+
guardar_registro(estado)
|
| 92 |
+
return f"🍽️ {nombre.title()} ≈ {calorias} cal. Restan {estado['restantes']} / {estado['meta_diaria']} cal."
|
| 93 |
+
|
| 94 |
+
def registrar_actividad(tipo, duracion):
|
| 95 |
+
if tipo not in actividades:
|
| 96 |
+
return "Selecciona una actividad válida."
|
| 97 |
+
quemadas = int(actividades[tipo] * (duracion / 60))
|
| 98 |
+
estado["restantes"] += quemadas
|
| 99 |
+
estado["quemas"] += quemadas
|
| 100 |
+
estado["registro"].append({
|
| 101 |
+
"fecha": str(datetime.datetime.now()), "tipo": "actividad",
|
| 102 |
+
"nombre": tipo, "calorias": quemadas
|
| 103 |
+
})
|
| 104 |
+
estado["puntos"] += 15
|
| 105 |
+
guardar_registro(estado)
|
| 106 |
+
return f"🏃♂️ {tipo} durante {duracion} min ≈ {quemadas} cal quemadas. Restantes: {estado['restantes']}."
|
| 107 |
+
|
| 108 |
+
def coach_emocional(emocion):
|
| 109 |
+
estado["emocion"] = emocion
|
| 110 |
+
sugerencias = {
|
| 111 |
+
"ansiedad": "🍌 Come un plátano o un puñado de nueces. Haz 3 respiraciones profundas.",
|
| 112 |
+
"tristeza": "🍫 Un cuadrito de chocolate oscuro puede ayudar. Escucha tu música favorita.",
|
| 113 |
+
"estrés": "🍵 Toma té verde y haz una pausa de 5 minutos.",
|
| 114 |
+
"feliz": "😄 ¡Genial! Mantén esa energía con frutas frescas o un smoothie."
|
| 115 |
+
}
|
| 116 |
+
guardar_registro(estado)
|
| 117 |
+
return sugerencias.get(emocion.lower(), "💬 Cuéntame más sobre cómo te sientes.")
|
| 118 |
+
|
| 119 |
+
def generar_mision():
|
| 120 |
+
mision = random.choice(misiones)
|
| 121 |
+
estado["mision_actual"] = mision
|
| 122 |
+
guardar_registro(estado)
|
| 123 |
+
return f"🎯 Tu misión de hoy: {mision}"
|
| 124 |
+
|
| 125 |
+
def chatbot_nuti(pregunta):
|
| 126 |
+
respuesta = buscar_respuesta(pregunta)
|
| 127 |
+
return f"🤖 Nuti dice: {respuesta}"
|
| 128 |
+
|
| 129 |
+
def buscar_nutriologo(pais, estado_, ciudad):
|
| 130 |
+
resultados = [n for n in nutriologos if
|
| 131 |
+
n["pais"].lower() == pais.lower() and
|
| 132 |
+
n["estado"].lower() == estado_.lower() and
|
| 133 |
+
n["ciudad"].lower() == ciudad.lower()]
|
| 134 |
+
if not resultados:
|
| 135 |
+
return "😔 No se encontraron nutriólogos en esa zona aún."
|
| 136 |
+
salida = "👩⚕️ Nutriólogos disponibles:\n"
|
| 137 |
+
for n in resultados:
|
| 138 |
+
salida += f"\n• {n['nombre']} — {n['especialidad']}\n 📍 {n['direccion']}\n 📞 {n['contacto']}\n"
|
| 139 |
+
return salida
|
| 140 |
+
|
| 141 |
+
# ---------------- INTERFAZ ----------------
|
| 142 |
+
usuario_actual = obtener_usuario_actual()
|
| 143 |
+
|
| 144 |
with gr.Blocks() as demo:
|
| 145 |
+
if usuario_actual is None:
|
| 146 |
+
# ---------- LOGIN / REGISTRO ----------
|
| 147 |
+
gr.Markdown("# 🥗 Bienvenido a NutriBot Ultra 🌈")
|
| 148 |
+
gr.Markdown("Por favor inicia sesión o crea una cuenta para continuar")
|
| 149 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
email_login = gr.Textbox(label="Correo electrónico")
|
| 151 |
pass_login = gr.Textbox(label="Contraseña", type="password")
|
| 152 |
salida_login = gr.Textbox(label="Mensaje")
|
| 153 |
+
|
| 154 |
+
nombre_reg = gr.Textbox(label="Nombre completo")
|
| 155 |
+
email_reg = gr.Textbox(label="Correo electrónico")
|
| 156 |
+
pass_reg = gr.Textbox(label="Contraseña", type="password")
|
| 157 |
+
salida_reg = gr.Textbox(label="Resultado del registro")
|
| 158 |
+
|
| 159 |
btn_login = gr.Button("Entrar")
|
| 160 |
+
btn_reg = gr.Button("Registrarse")
|
| 161 |
+
|
| 162 |
+
def login_click(email, password):
|
| 163 |
+
msg = iniciar_sesion(email, password)
|
| 164 |
+
if "✅" in msg:
|
| 165 |
+
# Si login exitoso, recarga la página para mostrar app principal
|
| 166 |
+
usuario = email
|
| 167 |
+
with open(SESION_FILE, "w") as f:
|
| 168 |
+
json.dump({"usuario": usuario}, f)
|
| 169 |
+
return gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
|
| 170 |
+
return msg
|
| 171 |
+
|
| 172 |
+
def reg_click(nombre, email, password):
|
| 173 |
+
return registrar_usuario(nombre, email, password)
|
| 174 |
+
|
| 175 |
+
btn_login.click(login_click, inputs=[email_login, pass_login], outputs=salida_login)
|
| 176 |
+
btn_reg.click(reg_click, inputs=[nombre_reg, email_reg, pass_reg], outputs=salida_reg)
|
| 177 |
+
|
| 178 |
+
else:
|
| 179 |
+
# ---------- APP PRINCIPAL ----------
|
| 180 |
+
gr.Markdown(f"👋 Hola, **{usuario_actual}**. Bienvenido a NutriBot Ultra!")
|
| 181 |
+
|
| 182 |
with gr.Tab("🧍 Tu perfil"):
|
| 183 |
edad = gr.Number(label="Edad (años)")
|
| 184 |
peso = gr.Number(label="Peso (kg)")
|
| 185 |
altura = gr.Number(label="Altura (cm)")
|
| 186 |
+
sexo = gr.Radio(["Hombre", "Mujer"], label="Sexo")
|
| 187 |
+
actividad = gr.Dropdown(["Sedentario", "Ligero", "Moderado", "Activo", "Muy activo"], label="Nivel de actividad")
|
| 188 |
btn_meta = gr.Button("Calcular meta calórica")
|
| 189 |
salida_meta = gr.Textbox(label="Resultado")
|
| 190 |
+
btn_meta.click(calcular_calorias, inputs=[edad, peso, altura, sexo, actividad], outputs=salida_meta)
|
| 191 |
+
|
| 192 |
+
with gr.Tab("📸 Tu comida"):
|
| 193 |
+
img = gr.Image(type="pil", label="Sube una foto de tu comida")
|
| 194 |
+
btn_foto = gr.Button("Analizar comida")
|
| 195 |
+
salida_foto = gr.Textbox(label="Resultado")
|
| 196 |
+
btn_foto.click(analizar_foto, inputs=img, outputs=salida_foto)
|
| 197 |
+
|
| 198 |
+
with gr.Tab("🏃 Actividad física"):
|
| 199 |
+
tipo = gr.Dropdown(list(actividades.keys()), label="Tipo de actividad")
|
| 200 |
+
duracion = gr.Number(label="Duración (minutos)")
|
| 201 |
+
btn_act = gr.Button("Registrar actividad")
|
| 202 |
+
salida_act = gr.Textbox(label="Resultado")
|
| 203 |
+
btn_act.click(registrar_actividad, inputs=[tipo, duracion], outputs=salida_act)
|
| 204 |
+
|
| 205 |
+
with gr.Tab("🧠 Coach emocional"):
|
| 206 |
+
emocion = gr.Textbox(label="¿Cómo te sientes hoy?")
|
| 207 |
+
btn_emocion = gr.Button("Enviar emoción")
|
| 208 |
+
salida_emocion = gr.Textbox(label="Consejo")
|
| 209 |
+
btn_emocion.click(coach_emocional, inputs=emocion, outputs=salida_emocion)
|
| 210 |
+
|
| 211 |
+
with gr.Tab("🎯 Misión saludable"):
|
| 212 |
+
btn_mision = gr.Button("Generar misión diaria")
|
| 213 |
+
salida_mision = gr.Textbox(label="Tu reto de hoy")
|
| 214 |
+
btn_mision.click(generar_mision, outputs=salida_mision)
|
| 215 |
+
|
| 216 |
+
with gr.Tab("👩⚕️ Nutriólogos recomendados"):
|
| 217 |
+
pais = gr.Textbox(label="País")
|
| 218 |
+
estado_ = gr.Textbox(label="Estado o provincia")
|
| 219 |
+
ciudad = gr.Textbox(label="Ciudad")
|
| 220 |
+
btn_buscar = gr.Button("Buscar nutriólogos")
|
| 221 |
+
salida_nutri = gr.Textbox(label="Resultados")
|
| 222 |
+
btn_buscar.click(buscar_nutriologo, inputs=[pais, estado_, ciudad], outputs=salida_nutri)
|
| 223 |
+
|
| 224 |
+
with gr.Tab("🤖 Nuti - Tu asistente"):
|
| 225 |
+
pregunta = gr.Textbox(label="Hazle una pregunta a Nuti 🍓")
|
| 226 |
+
btn_chat = gr.Button("Preguntar")
|
| 227 |
+
salida_chat = gr.Textbox(label="Respuesta de Nuti")
|
| 228 |
+
btn_chat.click(chatbot_nuti, inputs=pregunta, outputs=salida_chat)
|
| 229 |
|
| 230 |
demo.launch()
|