ramhemanth580 commited on
Commit
7cd4928
1 Parent(s): 53df120

Create app.py

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