qgallouedec HF staff commited on
Commit
1c155e2
1 Parent(s): 16f0e62

Adding app.py and requirements.txt

Browse files
Files changed (2) hide show
  1. app.py +21 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio_client import Client, handle_file
3
+
4
+
5
+ client_idefics2 = Client("HuggingFaceH4/idefics2-8b-playground")
6
+ client_idefics2_dpoed = Client("HuggingFaceH4/idefics2-8b-vdpoed-playground")
7
+
8
+
9
+ def respond(multimodal_input):
10
+ x = {"text": multimodal_input["text"], "files": [handle_file(file) for file in multimodal_input["files"]]}
11
+ text_1 = client_idefics2.predict(x, api_name="/predict")
12
+ text_2 = client_idefics2_dpoed.predict(x, api_name="/predict")
13
+ return text_1, text_2
14
+
15
+
16
+ gr.Interface(
17
+ respond,
18
+ inputs=[gr.MultimodalTextbox(file_types=["image"], show_label=False)],
19
+ outputs=[gr.Textbox(label="idefics2-8b"), gr.Textbox(label="idefics2-8b-dpoed")],
20
+ ).launch()
21
+
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio_client