Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,19 @@
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
5 |
|
6 |
-
|
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()
|
|