Spaces:
Sleeping
Sleeping
chatbot template
Browse files
app.py
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
demo = gr.
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
def slow_echo(message, history):
|
| 5 |
+
for i in range(len(message)):
|
| 6 |
+
time.sleep(0.05)
|
| 7 |
+
yield "You typed: " + message[: i + 1]
|
| 8 |
|
| 9 |
+
demo = gr.ChatInterface(
|
| 10 |
+
slow_echo,
|
| 11 |
+
type="messages",
|
| 12 |
+
flagging_mode="manual",
|
| 13 |
+
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
| 14 |
+
save_history=True,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
demo.launch()
|