Xinyu Wang
commited on
Commit
·
346a47e
1
Parent(s):
478cf05
I2U,?2
Browse files
app.py
CHANGED
|
@@ -1,9 +1,18 @@
|
|
| 1 |
import random
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
def
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
|
|
|
|
| 9 |
demo.launch()
|
|
|
|
| 1 |
import random
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
def response(message, history):
|
| 5 |
+
if "吗?" in message:
|
| 6 |
+
response_text_tmp = message.replace("吗?", "!")
|
| 7 |
+
if "我" in response_text_tmp:
|
| 8 |
+
response_text = response_text_tmp.replace("我", "你")
|
| 9 |
+
else:
|
| 10 |
+
response_text=response_text_tmp
|
| 11 |
+
else:
|
| 12 |
+
responses = ["I'm not sure.", "Interesting.", "Tell me more!"]
|
| 13 |
+
response_text = random.choice(responses)
|
| 14 |
|
| 15 |
+
return response_text
|
| 16 |
|
| 17 |
+
demo = gr.ChatInterface(response)
|
| 18 |
demo.launch()
|