LM77 commited on
Commit
b81f143
·
verified ·
1 Parent(s): 18b42a4

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
+ import gradio as gr
4
+ from transformers import pipeline
5
+
6
+ pipe = pipeline('image-to-text', model='Salesforce/blip-image-captioning-base')
7
+ def launch(input):
8
+ out = pipe(input)
9
+ return out[0]['generated_text']
10
+
11
+ iface = gr.Interface(launch,
12
+ inputs=gr.Image(type='pil'),
13
+ outputs="text")
14
+ iface.launch(share=True)