File size: 884 Bytes
20a15ba
 
 
 
 
 
 
 
 
 
 
 
 
6bff05f
 
7aaa4cb
6bff05f
20a15ba
 
 
608fe4e
20a15ba
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
import time

def count_files(message, history):
    print(f"messgae -- {message}")
    print(f"history -- {history}")
    num_files = len(message["files"])
    return f"You uploaded {num_files} files"


demo = gr.ChatInterface(fn=count_files, 
                        type="messages", 
                        examples=[
                            {"text": "Hello", 
                            "files": ["https://i.natgeofe.com/n/5f35194b-af37-4f45-a14d-60925b280986/NationalGeographic_2731043_square.jpg"]},
                            {"text": "another one with webp",
                            "files":["https://marketing.legal/files/AMBX545453KPG5T/images/wm-robot/waiter.webp"]},
     ], 
                        title="Echo Bot", 
                        multimodal=True, 
                        cache_examples=True)

demo.launch(debug=True, share=True)