bstraehle commited on
Commit
805ff2f
1 Parent(s): 9d3d926

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -75,6 +75,13 @@ def chat(message, msg2, history):
75
 
76
  return extract_content_values(messages)[0]
77
 
 
 
 
 
 
 
 
78
  gr.ChatInterface(
79
  chat,
80
  chatbot=gr.Chatbot(height=300),
@@ -91,4 +98,12 @@ gr.ChatInterface(
91
  #additional_inputs=[
92
  # gr.Textbox("sk-", label="OpenAI API Key", type = "password"),
93
  #],
94
- ).launch()
 
 
 
 
 
 
 
 
 
75
 
76
  return extract_content_values(messages)[0]
77
 
78
+ def vote(data: gr.LikeData):
79
+ if data.liked:
80
+ print("You upvoted this response: " + data.value["value"])
81
+ else:
82
+ print("You downvoted this response: " + data.value["value"])
83
+
84
+ """
85
  gr.ChatInterface(
86
  chat,
87
  chatbot=gr.Chatbot(height=300),
 
98
  #additional_inputs=[
99
  # gr.Textbox("sk-", label="OpenAI API Key", type = "password"),
100
  #],
101
+ ).launch()
102
+ """
103
+
104
+ with gr.Blocks() as demo:
105
+ chatbot = gr.Chatbot(placeholder="<strong>Math Tutor</strong><br>Ask Me Anything")
106
+ chatbot.like(vote, None, None)
107
+ gr.ChatInterface(fn=chat, chatbot=chatbot)
108
+
109
+ demo.launch()