Adnanmemic commited on
Commit
e902bb0
·
verified ·
1 Parent(s): b112c0c

Create app.py

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