from transformers import pipeline import gradio as gr pipe = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base") def genetreted_caption(images): result= pipe(images) return result[0]['generated_text'] interface= gr.Interface(genetreted_caption,inputs =gr.Image(type="pil"),outputs="text") interface.launch(share=True)