ailm commited on
Commit
28fa8d7
1 Parent(s): a359c19

gradio-application

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
+ from transformers import pipeline
3
+
4
+ model_pipeline = pipeline("image-to-text",
5
+ model = "Salesforce/blip-image-captioning-base")
6
+ #990M model
7
+
8
+ def main(input):
9
+ output = model_pipeline(input) #globally defined model pipeline
10
+ return output[0]['generated_text'] #generated output captoion string
11
+
12
+ interface_gradio = gr.Interface(
13
+ main,
14
+ inputs = gr.Image(type = 'pil'),
15
+ outputs = "text"
16
+ )
17
+
18
+ interface_gradio.launch()