Spaces:
Sleeping
Sleeping
gradio-pr-bot
commited on
Commit
•
152e31a
1
Parent(s):
b0b2784
Upload folder using huggingface_hub
Browse files- demos/chatbot_multimodal/run.py +7 -6
- requirements.txt +2 -2
demos/chatbot_multimodal/run.py
CHANGED
@@ -10,10 +10,10 @@ def print_like_dislike(x: gr.LikeData):
|
|
10 |
|
11 |
def add_message(history, message):
|
12 |
for x in message["files"]:
|
13 |
-
history.append(((x
|
14 |
if message["text"] is not None:
|
15 |
history.append((message["text"], None))
|
16 |
-
return history, gr.MultimodalTextbox(value=None, interactive=False
|
17 |
|
18 |
def bot(history):
|
19 |
response = "**That's cool!**"
|
@@ -33,10 +33,11 @@ with gr.Blocks() as demo:
|
|
33 |
)
|
34 |
|
35 |
chat_input = gr.MultimodalTextbox(interactive=True, file_types=["image"], placeholder="Enter message or upload file...", show_label=False)
|
36 |
-
|
37 |
-
|
38 |
-
)
|
39 |
-
|
|
|
40 |
chatbot.like(print_like_dislike, None, None)
|
41 |
|
42 |
demo.queue()
|
|
|
10 |
|
11 |
def add_message(history, message):
|
12 |
for x in message["files"]:
|
13 |
+
history.append(((x,), None))
|
14 |
if message["text"] is not None:
|
15 |
history.append((message["text"], None))
|
16 |
+
return history, gr.MultimodalTextbox(value=None, interactive=False)
|
17 |
|
18 |
def bot(history):
|
19 |
response = "**That's cool!**"
|
|
|
33 |
)
|
34 |
|
35 |
chat_input = gr.MultimodalTextbox(interactive=True, file_types=["image"], placeholder="Enter message or upload file...", show_label=False)
|
36 |
+
|
37 |
+
chat_msg = chat_input.submit(add_message, [chatbot, chat_input], [chatbot, chat_input])
|
38 |
+
bot_msg = chat_msg.then(bot, chatbot, chatbot, api_name="bot_response")
|
39 |
+
bot_msg.then(lambda: gr.MultimodalTextbox(interactive=True), None, [chat_input])
|
40 |
+
|
41 |
chatbot.like(print_like_dislike, None, None)
|
42 |
|
43 |
demo.queue()
|
requirements.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
|
2 |
-
gradio-client @ git+https://github.com/gradio-app/gradio@
|
3 |
-
https://gradio-builds.s3.amazonaws.com/
|
4 |
pypistats==1.1.0
|
5 |
plotly==5.10.0
|
6 |
opencv-python==4.6.0.66
|
|
|
1 |
|
2 |
+
gradio-client @ git+https://github.com/gradio-app/gradio@9a7b8667a5b8118da12a558e275d0720d664bfc7#subdirectory=client/python
|
3 |
+
https://gradio-builds.s3.amazonaws.com/9a7b8667a5b8118da12a558e275d0720d664bfc7/gradio-4.22.0-py3-none-any.whl
|
4 |
pypistats==1.1.0
|
5 |
plotly==5.10.0
|
6 |
opencv-python==4.6.0.66
|