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