Spaces:
Sleeping
Sleeping
Tim Seufert commited on
Commit ·
e3b6a11
1
Parent(s): 77f8e61
chatwindow_design_update
Browse files
app.py
CHANGED
|
@@ -50,12 +50,17 @@ def respond(message, image, chat_history):
|
|
| 50 |
return "", chat_history.append((message, f"Error: {str(e)}"))
|
| 51 |
|
| 52 |
# Create Gradio interface
|
| 53 |
-
|
|
|
|
| 54 |
chatbot = gr.Chatbot()
|
| 55 |
msg = gr.Textbox()
|
| 56 |
img = gr.Image(type="filepath")
|
| 57 |
clear = gr.ClearButton([msg, img, chatbot])
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
# Set up message submission
|
| 60 |
msg.submit(respond, [msg, img, chatbot], [msg, chatbot])
|
| 61 |
|
|
@@ -67,27 +72,6 @@ def respond(message, image, chat_history):
|
|
| 67 |
)
|
| 68 |
|
| 69 |
|
| 70 |
-
import time
|
| 71 |
-
import gradio as gr
|
| 72 |
-
|
| 73 |
-
def slow_echo(message, history):
|
| 74 |
-
for i in range(len(message)):
|
| 75 |
-
time.sleep(0.05)
|
| 76 |
-
yield "You typed: " + message[: i + 1]
|
| 77 |
-
|
| 78 |
-
demo = gr.ChatInterface(
|
| 79 |
-
slow_echo,
|
| 80 |
-
type="messages",
|
| 81 |
-
flagging_mode="manual",
|
| 82 |
-
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
| 83 |
-
save_history=True,
|
| 84 |
-
)
|
| 85 |
-
|
| 86 |
-
if __name__ == "__main__":
|
| 87 |
-
demo.launch()
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
|
| 92 |
#with gr.Interface() as iface:
|
| 93 |
#iface.add_textbox("Message", lines=7, label="Message")
|
|
|
|
| 50 |
return "", chat_history.append((message, f"Error: {str(e)}"))
|
| 51 |
|
| 52 |
# Create Gradio interface
|
| 53 |
+
|
| 54 |
+
with gr.ChatInterface() as demo:
|
| 55 |
chatbot = gr.Chatbot()
|
| 56 |
msg = gr.Textbox()
|
| 57 |
img = gr.Image(type="filepath")
|
| 58 |
clear = gr.ClearButton([msg, img, chatbot])
|
| 59 |
+
|
| 60 |
+
type="messages",
|
| 61 |
+
flagging_mode="manual",
|
| 62 |
+
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
| 63 |
+
save_history=True,
|
| 64 |
# Set up message submission
|
| 65 |
msg.submit(respond, [msg, img, chatbot], [msg, chatbot])
|
| 66 |
|
|
|
|
| 72 |
)
|
| 73 |
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
#with gr.Interface() as iface:
|
| 77 |
#iface.add_textbox("Message", lines=7, label="Message")
|