Spaces:
Running
Running
import gradio as gr | |
from transformers import pipeline | |
#Load the Image captioning pipeline | |
captioner = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base") | |
# Define the prediction function | |
def describe_image(image): | |
result = captioner(image)[0]["generated_text"] | |
return result | |
# Create the Gradio interface | |
gr.Interface( | |
fn=describe_image, | |
inputs=gr.Image(type="pil"), | |
outputs="text", | |
title="Image Describer", | |
description="Upload an image and this app will describe it!" | |
).launch(share=True) |