Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import time
|
3 |
+
|
4 |
+
def count_files(message, history):
|
5 |
+
print(f"messgae -- {message}")
|
6 |
+
print(f"history -- {history}")
|
7 |
+
num_files = len(message["files"])
|
8 |
+
return f"You uploaded {num_files} files"
|
9 |
+
|
10 |
+
|
11 |
+
demo = gr.ChatInterface(fn=count_files,
|
12 |
+
type="messages",
|
13 |
+
examples=[
|
14 |
+
{"text": "Hello",
|
15 |
+
"files": ["https://i.natgeofe.com/n/5f35194b-af37-4f45-a14d-60925b280986/NationalGeographic_2731043_square.jpg"]}
|
16 |
+
],
|
17 |
+
title="Echo Bot",
|
18 |
+
multimodal=True,
|
19 |
+
cache_examples=True)
|
20 |
+
|
21 |
+
demo.launch(debug=True, share=True)
|