|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
crop_pipe = pipeline("image-classification", model="LucyintheSky/pose-estimation-crop-uncrop") |
|
|
|
def classify(img): |
|
crop = crop_pipe(img) |
|
result = crop[0]['label'] + ' (' + int([0]['score']) * 100 + '%)' |
|
return result |
|
|
|
iface = gr.Interface(fn=classify, |
|
inputs=gr.Image(label='Image', type='filepath'), |
|
outputs=gr.Textbox(label='Output'), |
|
theme=gr.themes.Base(primary_hue=gr.themes.colors.pink, secondary_hue=gr.themes.colors.gray, neutral_hue=gr.themes.colors.slate, font=["avenir"])) |
|
iface.launch() |