Spaces:
Sleeping
Sleeping
| 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'] | |
| iface = gr.Interface(launch, | |
| inputs=[gr.Image(label="Upload Image",type='pil')], | |
| outputs=[gr.Textbox(label="Caption of the image provided", lines=3)], | |
| description="Caption any image using the BLIP model", | |
| title="Image Description", | |
| #examples=["uncle_bought_car.jpg","ajaj_photo.jpg","half_moon.jpg","scooty.jpg"] | |
| ) | |
| iface.launch() |