Gerofra commited on
Commit
c8b5a35
1 Parent(s): 6e68a35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -18
app.py CHANGED
@@ -70,36 +70,20 @@ def predict(message):
70
  )
71
 
72
  partial_message = ""
73
- respuesta_list = list(respuesta)
74
- for chunk in respuesta_list:
75
  if len(chunk['choices'][0]['delta']) != 0:
76
  partial_message = partial_message + chunk['choices'][0]['delta']['content']
77
  yield partial_message
78
 
79
- # Define la interfaz de Gradio para el nuevo index Doc_1
80
- gr.Interface(
81
- fn=predict,
82
- inputs=gr.Textbox("Escribe una pregunta...", label="Pregunta"),
83
- outputs=gr.Textbox(label="Respuesta"),
84
- title="Nuevo Titulo",
85
- description="Nueva Descripción",
86
- theme="soft",
87
- examples=["¿Se puede tomar con anticonceptivos?", "Hola"],
88
- cache_examples=True,
89
- button="Preguntar",
90
- clearbutton=None,
91
- ).launch()
92
 
93
  # Define la interfaz de Gradio para el nuevo index Doc_1
94
  gr.Interface(
95
  fn=predict,
96
- inputs=gr.Textbox("Escribe una pregunta...", label="Pregunta"),
97
  outputs=gr.Textbox(label="Respuesta"),
98
  title="Nuevo Titulo",
99
  description="Nueva Descripción",
100
  theme="soft",
101
  examples=["¿Se puede tomar con anticonceptivos?", "Hola"],
102
  cache_examples=True,
103
- button="Preguntar",
104
- clearbutton=None,
105
  ).launch()
 
70
  )
71
 
72
  partial_message = ""
73
+ for chunk in response:
 
74
  if len(chunk['choices'][0]['delta']) != 0:
75
  partial_message = partial_message + chunk['choices'][0]['delta']['content']
76
  yield partial_message
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  # Define la interfaz de Gradio para el nuevo index Doc_1
80
  gr.Interface(
81
  fn=predict,
82
+ inputs=gr.Textbox(placeholder="Escribe una pregunta...", label="Pregunta"),
83
  outputs=gr.Textbox(label="Respuesta"),
84
  title="Nuevo Titulo",
85
  description="Nueva Descripción",
86
  theme="soft",
87
  examples=["¿Se puede tomar con anticonceptivos?", "Hola"],
88
  cache_examples=True,
 
 
89
  ).launch()