Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,13 @@
|
|
| 1 |
-
!pip install transformers
|
| 2 |
-
!pip install gradio
|
| 3 |
-
!pip install gradio_client
|
| 4 |
-
pip install -U gradio_client
|
| 5 |
-
from transformers.utils import logging
|
| 6 |
-
logging.set_verbosity_error()
|
| 7 |
-
|
| 8 |
-
import warnings
|
| 9 |
-
warnings.filterwarnings("ignore",message="Using the model-agnostic default `max_length`")
|
| 10 |
-
import os
|
| 11 |
import gradio as gr
|
| 12 |
from transformers import pipeline
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
def launch(input):
|
| 15 |
out = pipe(input)
|
| 16 |
return out[0]['generated_text']
|
|
|
|
| 17 |
iface = gr.Interface(launch,
|
| 18 |
-
inputs=gr.Image(type='pil'),
|
| 19 |
-
outputs="text")
|
| 20 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
pipe = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
|
| 5 |
+
|
| 6 |
def launch(input):
|
| 7 |
out = pipe(input)
|
| 8 |
return out[0]['generated_text']
|
| 9 |
+
|
| 10 |
iface = gr.Interface(launch,
|
| 11 |
+
inputs=gr.inputs.Image(type='pil'),
|
| 12 |
+
outputs="text")
|
| 13 |
+
iface.launch(share=True)
|