mboushaba commited on
Commit
c62b051
·
verified ·
1 Parent(s): d3752ec

Create app.py

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