File size: 775 Bytes
804d2ec
60c3596
804d2ec
 
8d170b2
804d2ec
8d170b2
dfd8178
4280a69
bc51b68
 
 
4280a69
4673364
1609e16
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#                                                                                                                 
# 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()