Spaces:
Runtime error
Runtime error
Download app.py from jurgenizer/image-captioning: direct link, hf CLI and curl.
- Browser
- Download file 471 Bytes
-
https://huggingface.co/spaces/jurgenizer/image-captioning/resolve/main/app.py
- Command line
-
hf download hf://spaces/jurgenizer/image-captioning/app.py
-
curl -L -o app.py https://huggingface.co/spaces/jurgenizer/image-captioning/resolve/main/app.py
471 Bytes
| import os | |
| import gradio as gr | |
| from transformers import pipeline | |
| pipe = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base") | |
| def launch(input): | |
| out = pipe(input) | |
| return out[0]['generated_text'] | |
| import gradio as gr | |
| gr.Blocks(theme='jurgenizer/dark-sky') | |
| iface = gr.Interface(launch, | |
| theme='jurgenizer/dark-sky', | |
| inputs=gr.Image(type='pil'), | |
| outputs="text") | |
| iface.launch() | |