emaaaa543 commited on
Commit
28fb9d0
·
verified ·
1 Parent(s): 5d68233

Create app.py

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