Spaces:
Runtime error
Runtime error
Add files
Browse files
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import time
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def bot(message, history):
|
| 7 |
+
out = []
|
| 8 |
+
for word in "This is a test.".split():
|
| 9 |
+
out.append(word)
|
| 10 |
+
time.sleep(1)
|
| 11 |
+
yield " ".join(out)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
examples = [
|
| 15 |
+
{
|
| 16 |
+
"text": "hey",
|
| 17 |
+
"files": ["cats.jpg", "dogs.jpg"],
|
| 18 |
+
},
|
| 19 |
+
]
|
| 20 |
+
|
| 21 |
+
demo = gr.ChatInterface(
|
| 22 |
+
fn=bot,
|
| 23 |
+
multimodal=True,
|
| 24 |
+
textbox=gr.MultimodalTextbox(
|
| 25 |
+
file_types=["image"],
|
| 26 |
+
file_count="multiple",
|
| 27 |
+
),
|
| 28 |
+
examples=examples,
|
| 29 |
+
cache_examples=False,
|
| 30 |
+
)
|
| 31 |
+
demo.queue().launch()
|
cats.jpg
ADDED
|
dogs.jpg
ADDED
|