Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
pipe = pipeline("image-to-text", | |
model="Salesforce/blip-image-captioning-base", force_download=True) | |
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")], | |
title="ImageLexica", | |
description="Generate captions for any image from your Gallery", | |
allow_flagging="never") | |
iface.launch() |