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