import gradio as gr from transformers import BlipProcessor, BlipForConditionalGeneration processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base") model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base") def execute(image): model_inputs = processor(image, return_tensors="pt") output = processor.decode(model.generate(**model_inputs)[0], skip_special_tokens=True) return output iface = gr.Interface(fn=execute, inputs="image", outputs="textbox") iface.launch()