Azhs commited on
Commit
865e3fd
·
verified ·
1 Parent(s): 773ac46

Update app.py

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