Spaces:
Sleeping
Sleeping
Priyanshi3
commited on
Commit
•
612fcea
1
Parent(s):
88f1c7c
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import gradio as gr
|
3 |
+
from transformers import pipeline
|
4 |
+
pipe = pipeline("image-to-text",
|
5 |
+
model="Salesforce/blip-image-captioning-base")
|
6 |
+
def launch(input):
|
7 |
+
out = pipe(input)
|
8 |
+
return out[0]['generated_text']
|
9 |
+
iface = gr.Interface(launch,
|
10 |
+
inputs=gr.Image(type='pil'),
|
11 |
+
outputs="text")
|
12 |
+
iface.launch()
|