Spaces:
Sleeping
Sleeping
added random.choices
Browse files
app.py
CHANGED
|
@@ -1,23 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import random as rm
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
def rm(data: gr.LikeData):
|
| 11 |
-
if data.liked:
|
| 12 |
-
print("You upvoted this response: " + data.value["value"])
|
| 13 |
-
else:
|
| 14 |
-
print("You downvoted this response: " + data.value["value"])
|
| 15 |
-
|
| 16 |
-
with gr.Blocks() as demo:
|
| 17 |
-
chatbot = gr.Chatbot(placeholder="<strong>Your Personal Yes-Man</strong><br>Ask Me Anything")
|
| 18 |
-
chatbot.like(vote, None, None)
|
| 19 |
-
gr.ChatInterface(fn=yes, type="messages", chatbot=chatbot)
|
| 20 |
-
|
| 21 |
-
demo.launch()
|
| 22 |
|
| 23 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import random as rm
|
| 3 |
|
| 4 |
+
def respond_yes_or_no(message, history):
|
| 5 |
+
random.choices (["yes", "girl no"])
|
| 6 |
+
return random.choice (responces)
|
| 7 |
|
| 8 |
+
chatbot = gr.ChatInterface(respond_yes_or_no, type='meessages')
|
| 9 |
+
chatbot.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|