Spaces:
Running
Running
Tim Seufert
commited on
Commit
·
d5bee63
1
Parent(s):
e1c94e5
update interface beta test2
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
import gradio as gr
|
3 |
import cohere
|
4 |
|
@@ -43,21 +44,23 @@ def respond(message, chat_history):
|
|
43 |
except Exception as e:
|
44 |
return str(e), chat_history
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
clear = gr.ClearButton([msg, chatbot])
|
51 |
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
-
|
56 |
demo.launch(
|
57 |
share=True,
|
58 |
server_name="0.0.0.0",
|
59 |
allowed_paths=["*"]
|
60 |
-
)
|
61 |
-
|
62 |
-
if __name__ == "__main__":
|
63 |
-
demo.launch()
|
|
|
1 |
import os
|
2 |
+
import time
|
3 |
import gradio as gr
|
4 |
import cohere
|
5 |
|
|
|
44 |
except Exception as e:
|
45 |
return str(e), chat_history
|
46 |
|
47 |
+
def slow_echo(message, history):
|
48 |
+
for i in range(len(message)):
|
49 |
+
time.sleep(0.05)
|
50 |
+
yield "You typed: " + message[: i + 1]
|
|
|
51 |
|
52 |
+
# Create Gradio interface
|
53 |
+
demo = gr.ChatInterface(
|
54 |
+
respond,
|
55 |
+
type="messages",
|
56 |
+
flagging_mode="manual",
|
57 |
+
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
58 |
+
save_history=True,
|
59 |
+
)
|
60 |
|
61 |
+
if __name__ == "__main__":
|
62 |
demo.launch(
|
63 |
share=True,
|
64 |
server_name="0.0.0.0",
|
65 |
allowed_paths=["*"]
|
66 |
+
)
|
|
|
|
|
|