Azhs commited on
Commit
52386f4
·
verified ·
1 Parent(s): fba408d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -288,6 +288,7 @@ def respond(message, chat_history):
288
  chat_history.append((response, None))
289
  return chat_history
290
 
 
291
  def suggestion1(chat_history):
292
  response = generate_text(suggestion[0])
293
  chat_history.append((None, suggestion[0]))
@@ -305,6 +306,7 @@ def suggestion3(chat_history):
305
  chat_history.append((None, suggestion[2]))
306
  chat_history.append((response, None))
307
  return chat_history
 
308
 
309
  user_profile_image = "https://huggingface.co/spaces/ALOQAS/aloqas-gradio/resolve/main/img/user.png"
310
  bot_profile_image = "https://huggingface.co/spaces/ALOQAS/aloqas-gradio/resolve/main/img/bot.png"
@@ -321,13 +323,13 @@ with gr.Blocks(theme=theme, css=css) as demo: # Suppression de 'css=css' si 'cs
321
  chat = gr.Chatbot(elem_id="chat-messages", show_label=False, avatar_images=[bot_profile_image, user_profile_image])
322
  with gr.Row(elem_id="suggestions"):
323
  sugg1 = gr.Button(suggestion[0], elem_classes="suggestion-btn").click(
324
- suggestion1, inputs=[chat], outputs=chat
325
  )
326
  sugg2 = gr.Button(suggestion[1], elem_classes="suggestion-btn").click(
327
- suggestion2, inputs=[chat], outputs=chat
328
  )
329
  sugg3 = gr.Button(suggestion[2], elem_classes="suggestion-btn").click(
330
- suggestion3, inputs=[chat], outputs=chat
331
  )
332
  with gr.Row(elem_id="input-area"):
333
  text_input = gr.Textbox(placeholder="Write to ALOQAS...", show_label=False)
 
288
  chat_history.append((response, None))
289
  return chat_history
290
 
291
+ """
292
  def suggestion1(chat_history):
293
  response = generate_text(suggestion[0])
294
  chat_history.append((None, suggestion[0]))
 
306
  chat_history.append((None, suggestion[2]))
307
  chat_history.append((response, None))
308
  return chat_history
309
+ """
310
 
311
  user_profile_image = "https://huggingface.co/spaces/ALOQAS/aloqas-gradio/resolve/main/img/user.png"
312
  bot_profile_image = "https://huggingface.co/spaces/ALOQAS/aloqas-gradio/resolve/main/img/bot.png"
 
323
  chat = gr.Chatbot(elem_id="chat-messages", show_label=False, avatar_images=[bot_profile_image, user_profile_image])
324
  with gr.Row(elem_id="suggestions"):
325
  sugg1 = gr.Button(suggestion[0], elem_classes="suggestion-btn").click(
326
+ respond, inputs=[suggestion[0],chat], outputs=chat
327
  )
328
  sugg2 = gr.Button(suggestion[1], elem_classes="suggestion-btn").click(
329
+ respond, inputs=[suggestion[1];chat], outputs=chat
330
  )
331
  sugg3 = gr.Button(suggestion[2], elem_classes="suggestion-btn").click(
332
+ respond, inputs=[suggestion[2],chat], outputs=chat
333
  )
334
  with gr.Row(elem_id="input-area"):
335
  text_input = gr.Textbox(placeholder="Write to ALOQAS...", show_label=False)