preston-cell commited on
Commit
8b7d5f5
·
verified ·
1 Parent(s): 0b4d167

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a pipeline as a high-level helper
2
+ from transformers import pipeline
3
+ import gradio as gr
4
+
5
+ messages = [
6
+ {"role": "user", "content": "Who are you?"},
7
+ ]
8
+ pipe = pipeline("image-text-to-text", model="Qwen/Qwen2.5-VL-7B-Instruct")
9
+ pipe(messages)
10
+
11
+ def launch(input):
12
+ out = pipe(input)
13
+ return out[0]['generated_text']
14
+
15
+ iface = gr.Interface(launch,
16
+ inputs=gr.Image(type='pil'),
17
+ outputs="text")
18
+
19
+ iface.launch()