Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
#
|
| 3 |
-
|
| 4 |
-
import gradio as gr # Intefax gradio en Español usando Blocks
|
| 5 |
from groq import Groq
|
| 6 |
|
| 7 |
# Inicializar el cliente Groq
|
| 8 |
client = Groq()
|
| 9 |
|
| 10 |
# Función para manejar la completación del chat
|
| 11 |
-
def chat_con_bot(
|
|
|
|
| 12 |
completion = client.chat.completions.create(
|
| 13 |
model="llama-3.1-70b-versatile",
|
| 14 |
messages=[
|
|
@@ -34,15 +32,22 @@ def chat_con_bot(mensaje_usuario):
|
|
| 34 |
# Configurar la interfaz de Gradio usando Blocks
|
| 35 |
with gr.Blocks() as interfaz:
|
| 36 |
gr.Markdown("# Chat con IA\nChatea con Llama 3.1 70B en español")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
with gr.Row():
|
| 38 |
-
mensaje = gr.Textbox(label="Escribe tu mensaje")
|
| 39 |
respuesta = gr.Textbox(label="Respuesta del bot")
|
|
|
|
| 40 |
with gr.Row():
|
| 41 |
enviar = gr.Button("Enviar")
|
| 42 |
limpiar = gr.Button("Limpiar")
|
| 43 |
|
| 44 |
-
enviar.click(fn=chat_con_bot, inputs=
|
| 45 |
-
limpiar.click(fn=lambda: "", inputs=None, outputs=
|
| 46 |
|
| 47 |
# Lanzar la aplicación
|
| 48 |
interfaz.launch()
|
|
|
|
| 1 |
+
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
from groq import Groq
|
| 3 |
|
| 4 |
# Inicializar el cliente Groq
|
| 5 |
client = Groq()
|
| 6 |
|
| 7 |
# Función para manejar la completación del chat
|
| 8 |
+
def chat_con_bot(ciudad, informacion_clinica):
|
| 9 |
+
mensaje_usuario = f"Ciudad: {ciudad}. Información clínica: {informacion_clinica}"
|
| 10 |
completion = client.chat.completions.create(
|
| 11 |
model="llama-3.1-70b-versatile",
|
| 12 |
messages=[
|
|
|
|
| 32 |
# Configurar la interfaz de Gradio usando Blocks
|
| 33 |
with gr.Blocks() as interfaz:
|
| 34 |
gr.Markdown("# Chat con IA\nChatea con Llama 3.1 70B en español")
|
| 35 |
+
|
| 36 |
+
with gr.Row():
|
| 37 |
+
ciudad = gr.Textbox(label="¿En qué ciudad o municipio vives?")
|
| 38 |
+
|
| 39 |
+
with gr.Row():
|
| 40 |
+
informacion_clinica = gr.Textbox(label="¿Cuáles son tus síntomas, desde cuándo aparecieron, cuál es tu sexo, edad, y antecedentes médicos, fármacos y si hay algún hallazgo físico observable?")
|
| 41 |
+
|
| 42 |
with gr.Row():
|
|
|
|
| 43 |
respuesta = gr.Textbox(label="Respuesta del bot")
|
| 44 |
+
|
| 45 |
with gr.Row():
|
| 46 |
enviar = gr.Button("Enviar")
|
| 47 |
limpiar = gr.Button("Limpiar")
|
| 48 |
|
| 49 |
+
enviar.click(fn=chat_con_bot, inputs=[ciudad, informacion_clinica], outputs=respuesta)
|
| 50 |
+
limpiar.click(fn=lambda: ("", ""), inputs=None, outputs=[ciudad, informacion_clinica])
|
| 51 |
|
| 52 |
# Lanzar la aplicación
|
| 53 |
interfaz.launch()
|