turtlegraphics's picture
Pick out the text.
bc51b68 verified
raw
history blame contribute delete
775 Bytes
#
# Image Recognition with MobileNetv2
#
import gradio as gr
from transformers import pipeline
pipe = pipeline("image-to-text", model="microsoft/git-base")
def classify(image):
output = pipe(image)
# example: [{'generated_text': 'front wheels of a truck'}]
return output[0]['generated_text']
demo = gr.Interface(fn=classify, inputs=gr.Image(type="filepath"), outputs="text", title="Image Captioning with git-base")
demo.launch()