#import pipeline function from huggingface transformers and gradio from transformers import pipeline import gradio as gr #choosing the model distilbart for text-summarization (the default will be the same) get_completion = pipeline( "image-to-text",model="Salesforce/blip-image-captioning-base" ) def captioner(input_image): result = get_completion(input_image) return result[0]["generated_text"] #create an interface for the model #with gr.Interface(summarize, "textbox", "text") as interface: #interface.launch() demo = gr.Interface(captioner, inputs = [gr.Image(label="Upload any image here", type="pil")], #customize the UI with gradio components textbox, and size of text fields outputs = [gr.Textbox(label="Caption")],#customize the UI with gradio components textbox,and size of text fields title = "Image Caption Generation App with BLIP",#add title for app allow_flagging="never") demo.launch()