import os import gradio as gr from transformers import pipeline model_id = "Salesforce/blip-vqa-base" pipe = pipeline("image-to-text", model=model_id) def launch(input): out = pipe(input) return out[0]['generated_text'] iface = gr.Interface(launch, inputs=gr.Image(type='pil'), outputs="text") iface.launch()