CoolFace
Apppublic

KrishnaRDL/stringinstruments

sourceHugging Faceapache-2.0updated 4y agoView on Hugging Face
0likes
app.py15 linesDownload Raw Back to root
1import gradio as gr2from fastai.vision.all import *3import skimage4 5learn = load_learner('strings.pkl')6 7labels = learn.dls.vocab8def predict(img):9    img = PILImage.create(img)10    pred,pred_idx,probs = learn.predict(img)11    return {labels[i]: float(probs[i]) for i in range(len(labels))}12 13gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=4)).launch(share=False)14 15