msmmpts commited on
Commit
fcf45fd
·
verified ·
1 Parent(s): e28c517

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ pipe = pipeline(task="image-to-text",
5
+ model = "Salesforce/blip-image-captioning-base")
6
+
7
+ def launch(input):
8
+ out = pipe(input)
9
+ return out[0]['generated_text']
10
+
11
+ # iface = gr.Interface(
12
+ # fn = launch,
13
+ # inputs = gr.Image(type='pil',),
14
+ # outputs = gr.Textbox()
15
+ # )
16
+ # iface.launch()
17
+
18
+ iface = gr.Interface(launch,
19
+ inputs=gr.Image(type='pil'),
20
+ outputs="text")
21
+
22
+ iface.launch()