Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def
|
4 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
demo.launch()
|
|
|
1 |
+
# import gradio as gr
|
2 |
+
|
3 |
+
# def echo(message, history):
|
4 |
+
# return message
|
5 |
+
|
6 |
+
# demo = gr.ChatInterface(fn=echo, type="messages", examples=["hello", "hola", "merhaba"], title="Echo Bot")
|
7 |
+
# demo.launch()
|
8 |
+
|
9 |
import gradio as gr
|
10 |
|
11 |
+
def yes(message, history):
|
12 |
+
return "yes"
|
13 |
+
|
14 |
+
def vote(data: gr.LikeData):
|
15 |
+
if data.liked:
|
16 |
+
print("You upvoted this response: " + data.value["value"])
|
17 |
+
else:
|
18 |
+
print("You downvoted this response: " + data.value["value"])
|
19 |
|
20 |
+
with gr.Blocks() as demo:
|
21 |
+
chatbot = gr.Chatbot(placeholder="<strong>Your Personal Yes-Man</strong><br>Ask Me Anything")
|
22 |
+
chatbot.like(vote, None, None)
|
23 |
+
gr.ChatInterface(fn=yes, type="messages", chatbot=chatbot)
|
24 |
+
|
25 |
demo.launch()
|