MSaadTariq's picture
Update app.py
e6fd7a9 verified
raw
history blame contribute delete
599 Bytes
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()