talinm2 commited on
Commit
56a0e24
1 Parent(s): 363cabd

Create app.py

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