rayl-aoit commited on
Commit
b68b290
1 Parent(s): 3d97242

Update app.py

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