OuroborosM commited on
Commit
febac0d
·
1 Parent(s): d5a915a

add like function

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -1882,7 +1882,11 @@ def SingleTalk(WavFile, history5):
1882
  print("-" * 20)
1883
 
1884
 
1885
-
 
 
 
 
1886
 
1887
  with gr.Blocks() as demo:
1888
  # gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
@@ -1918,6 +1922,7 @@ with gr.Blocks() as demo:
1918
  chatbot = gr.Chatbot(
1919
  # avatar_images=((os.path.join(os.path.dirname(__file__),"User.png")), (os.path.join(os.path.dirname(__file__),"AI.png"))),
1920
  )
 
1921
  with gr.Row():
1922
  inputtext = gr.Textbox(
1923
  scale= 4,
@@ -1970,7 +1975,7 @@ with gr.Blocks() as demo:
1970
  """
1971
 
1972
  # upload_button.upload(func_upload_file, [upload_button, main.chatbot], main.chatbot)
1973
-
1974
  retry_button.click(retry, chatbot, chatbot).success(playsound1, None, voice_output).\
1975
  success(HMI_Wait, None, [submit_button, stop_button])#.\
1976
  # success(ClearAudio, None, voice_output)
 
1882
  print("-" * 20)
1883
 
1884
 
1885
+ def vote(data: gr.LikeData):
1886
+ if data.liked:
1887
+ print("You upvoted this response: " + data.value)
1888
+ else:
1889
+ print("You downvoted this response: " + data.value)
1890
 
1891
  with gr.Blocks() as demo:
1892
  # gr.Markdown("Start typing below and then click **SUBMIT** to see the output.")
 
1922
  chatbot = gr.Chatbot(
1923
  # avatar_images=((os.path.join(os.path.dirname(__file__),"User.png")), (os.path.join(os.path.dirname(__file__),"AI.png"))),
1924
  )
1925
+
1926
  with gr.Row():
1927
  inputtext = gr.Textbox(
1928
  scale= 4,
 
1975
  """
1976
 
1977
  # upload_button.upload(func_upload_file, [upload_button, main.chatbot], main.chatbot)
1978
+ chatbot.like(vote, None, None)
1979
  retry_button.click(retry, chatbot, chatbot).success(playsound1, None, voice_output).\
1980
  success(HMI_Wait, None, [submit_button, stop_button])#.\
1981
  # success(ClearAudio, None, voice_output)