gera commited on
Commit
278b485
1 Parent(s): 43a59d3
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -15,7 +15,7 @@ ANS_LONG = "Detallada"
15
  def chat(user_message, history, state, long_or_short):
16
  if (state is None) or (not state['user']):
17
  gr.Warning("You need to authenticate first")
18
- yield
19
  else:
20
  thread = state['thread']
21
  if thread is None:
@@ -56,7 +56,7 @@ def chat(user_message, history, state, long_or_short):
56
  def chat_nostream(user_message, history, state):
57
  if (state is None) or (not state['user']):
58
  gr.Warning("You need to authenticate first")
59
- yield
60
  else:
61
  thread = state['thread']
62
  if thread is None:
@@ -119,20 +119,20 @@ AUTH_JS = """function auth_js(token, state) {
119
 
120
  theme = gr.Theme.from_hub("freddyaboulton/dracula_revamped@0.3.9")
121
  theme.set(
122
- color_accent_soft="#6272a4",
 
123
  button_primary_text_color="*button_secondary_text_color",
124
  button_primary_background_fill="*button_secondary_background_fill")
125
 
126
  with gr.Blocks(
127
  title="Dr. Luis Chiozza - Medicina y Psicoanalisis",
128
  fill_height=True,
129
- theme=theme,
130
- theme=gr.themes.Base()) as demo:
131
  state = new_state()
132
 
133
  gr.HTML("""
134
  <h1>Dr. Luis Chiozza - Medicina y Psicoanalisis</h1>
135
- <p>Habla con la colección de Medicina y Psicoanalisis del Dr. Luis Chiozza</p>
136
  """)
137
  with gr.Row(variant="compact"):
138
  gr.HTML("Largo de la respuesta")
@@ -146,11 +146,17 @@ with gr.Blocks(
146
 
147
  gr.ChatInterface(
148
  chat,
 
149
  additional_inputs=[state, long_or_short],
150
  examples=[
151
  ["Qué diferencias hay entre el cuerpo y el Alma?"],
152
  ["Cuáles son las distintas funciones de los órganos del cuerpo y su relación con el alma?"],
153
  ],
 
 
 
 
 
154
  )
155
 
156
  token = gr.Textbox(visible=False)
 
15
  def chat(user_message, history, state, long_or_short):
16
  if (state is None) or (not state['user']):
17
  gr.Warning("You need to authenticate first")
18
+ yield "You need to authenticate first"
19
  else:
20
  thread = state['thread']
21
  if thread is None:
 
56
  def chat_nostream(user_message, history, state):
57
  if (state is None) or (not state['user']):
58
  gr.Warning("You need to authenticate first")
59
+ yield "You need to authenticate first"
60
  else:
61
  thread = state['thread']
62
  if thread is None:
 
119
 
120
  theme = gr.Theme.from_hub("freddyaboulton/dracula_revamped@0.3.9")
121
  theme.set(
122
+ color_accent_soft="#818eb6", # ChatBot.svelte / .message-row.panel.user-row
123
+ background_fill_secondary="#6272a4", # ChatBot.svelte / .message-row.panel.bot-row
124
  button_primary_text_color="*button_secondary_text_color",
125
  button_primary_background_fill="*button_secondary_background_fill")
126
 
127
  with gr.Blocks(
128
  title="Dr. Luis Chiozza - Medicina y Psicoanalisis",
129
  fill_height=True,
130
+ theme=theme) as demo:
 
131
  state = new_state()
132
 
133
  gr.HTML("""
134
  <h1>Dr. Luis Chiozza - Medicina y Psicoanalisis</h1>
135
+ <p>Habla con la colección de Libros de Medicina y Psicoanalisis del Dr. Luis Chiozza</p>
136
  """)
137
  with gr.Row(variant="compact"):
138
  gr.HTML("Largo de la respuesta")
 
146
 
147
  gr.ChatInterface(
148
  chat,
149
+ chatbot=gr.Chatbot(show_label=False, render=False, layout = "panel"),
150
  additional_inputs=[state, long_or_short],
151
  examples=[
152
  ["Qué diferencias hay entre el cuerpo y el Alma?"],
153
  ["Cuáles son las distintas funciones de los órganos del cuerpo y su relación con el alma?"],
154
  ],
155
+ submit_btn="Enviar",
156
+ stop_btn="Detener",
157
+ undo_btn=None,
158
+ clear_btn="Borrar",
159
+ retry_btn=None
160
  )
161
 
162
  token = gr.Textbox(visible=False)