Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,17 @@ import os
|
|
3 |
import time
|
4 |
|
5 |
# Chatbot demo with multimodal input (text, markdown, LaTeX, code blocks, image, audio, & video). Plus shows support for streaming text.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
|
8 |
def print_like_dislike(x: gr.LikeData):
|
@@ -39,20 +50,23 @@ with gr.Blocks() as demo:
|
|
39 |
chatbot.like(print_like_dislike, None, None)
|
40 |
|
41 |
#demo.queue()
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
def echo(message, history):
|
44 |
return message["text"]
|
45 |
|
46 |
demo1 = gr.ChatInterface(fn=echo,
|
47 |
multimodal=True,
|
48 |
-
|
49 |
-
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://miro.medium.com/v2/resize:fit:930/1*OaV5eb_DRNIJQal_B7-YDQ.jpeg"]}],
|
50 |
-
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://miro.medium.com/v2/resize:fit:930/1*OaV5eb_DRNIJQal_B7-YDQ.jpeg"]}],
|
51 |
-
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://www.gradio.app/_app/immutable/assets/header-image.DJQS6l6U.jpg"]}],
|
52 |
-
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://miro.medium.com/v2/da:true/resize:fit:1024/1*iJArJfAGlqMj7Uz7OU-Hdw.gif"]}],
|
53 |
-
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://digitalpress.fra1.cdn.digitaloceanspaces.com/mhujhsj/2022/09/seaborn.gif"]}],
|
54 |
-
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://user-images.githubusercontent.com/1778297/158659207-04015a06-5cad-4ee1-bdbd-291054551540.png"]}],
|
55 |
-
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://user-images.githubusercontent.com/1778297/158659207-04015a06-5cad-4ee1-bdbd-291054551540.png"]}]],
|
56 |
title="Echo Bot",
|
57 |
#examples_per_page=6,
|
58 |
|
|
|
3 |
import time
|
4 |
|
5 |
# Chatbot demo with multimodal input (text, markdown, LaTeX, code blocks, image, audio, & video). Plus shows support for streaming text.
|
6 |
+
theme = gr.themes.Base()
|
7 |
+
#theme = gr.themes.Default()
|
8 |
+
#theme = gr.themes.Glass()
|
9 |
+
#theme = gr.themes.Monochrome()
|
10 |
+
#theme = gr.themes.Soft()
|
11 |
+
|
12 |
+
with gr.Blocks(theme=theme) as demo2:
|
13 |
+
mmt = gr.MultimodalTextbox()
|
14 |
+
mmt = gr.MultimodalTextbox(interactive=True, file_types=["image"], placeholder="Enter message or upload file...", show_label=False)
|
15 |
+
|
16 |
+
#demo1.launch()
|
17 |
|
18 |
|
19 |
def print_like_dislike(x: gr.LikeData):
|
|
|
50 |
chatbot.like(print_like_dislike, None, None)
|
51 |
|
52 |
#demo.queue()
|
53 |
+
examples=[
|
54 |
+
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://miro.medium.com/v2/resize:fit:930/1*OaV5eb_DRNIJQal_B7-YDQ.jpeg"]}],
|
55 |
+
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://miro.medium.com/v2/resize:fit:930/1*OaV5eb_DRNIJQal_B7-YDQ.jpeg"]}],
|
56 |
+
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://miro.medium.com/v2/resize:fit:930/1*OaV5eb_DRNIJQal_B7-YDQ.jpeg"]}],
|
57 |
+
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://www.gradio.app/_app/immutable/assets/header-image.DJQS6l6U.jpg"]}],
|
58 |
+
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://miro.medium.com/v2/da:true/resize:fit:1024/1*iJArJfAGlqMj7Uz7OU-Hdw.gif"]}],
|
59 |
+
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://digitalpress.fra1.cdn.digitaloceanspaces.com/mhujhsj/2022/09/seaborn.gif"]}],
|
60 |
+
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://user-images.githubusercontent.com/1778297/158659207-04015a06-5cad-4ee1-bdbd-291054551540.png"]}],
|
61 |
+
[{"text": "This is a sample text. This is a sample text. This is a sample text.", "files":["https://user-images.githubusercontent.com/1778297/158659207-04015a06-5cad-4ee1-bdbd-291054551540.png"]}],
|
62 |
+
]
|
63 |
+
|
64 |
def echo(message, history):
|
65 |
return message["text"]
|
66 |
|
67 |
demo1 = gr.ChatInterface(fn=echo,
|
68 |
multimodal=True,
|
69 |
+
theme=theme,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
title="Echo Bot",
|
71 |
#examples_per_page=6,
|
72 |
|