CoolFace
Apppublic

Songj/DotaHeroClassifier

sourceHugging Faceapache-2.0updated 4y agoView on Hugging Face
1likes
app.py19 linesDownload Raw Back to root
1import gradio as gr
2from fastai.vision.all import *
3import skimage
4
5learn = load_learner('dotahero.pkl')
6
7labels = learn.dls.vocab
8def predict(img):
9    pred,pred_idx,probs = learn.predict(img)
10    return {labels[i]: float(probs[i]) for i in range(len(labels))}
11
12title = "DotaHeros Classifier"
13description = "A Dota Hero Created as a demo for Gradio and HuggingFace Spaces."
14examples = ['evt_gen.png','SF.jpg']
15interpretation='default'
16enable_queue=True
17
18gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
19