Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
!pip install gradio
|
3 |
+
|
4 |
+
pipe=pipeline("image-to-text",model="Salesforce/blip-image-captioning-base")
|
5 |
+
|
6 |
+
def launch(input):
|
7 |
+
output=pipe(input)
|
8 |
+
return output[0]['generated_text']
|
9 |
+
|
10 |
+
iface=gr.Interface(
|
11 |
+
fn=launch,
|
12 |
+
inputs=gr.Image(type='pil'),
|
13 |
+
outputs="text"
|
14 |
+
)
|
15 |
+
|
16 |
+
iface.launch()
|
17 |
+
|