CoolFace
Apppublic

RaymondDashWu/mlh_hackathon_sum22

sourceHugging Faceupdated 4y agoView on Hugging Face
0likes
app.py20 linesDownload Raw Back to root
1import gradio as gr2from fastai.vision.all import *3import skimage4 5learn = load_learner('model.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 13title = "Pothole detector"14description = "Detect potholes on Mapillary images. Created as part of a hackathon for MLH Hackathon Summer 2022"15article="<p style='text-align: center'><a href='https://devpost.com/software/i-spy-but-with-ev-chargers-and-bike-racks' target='_blank'>Blog post</a></p>"16examples = ['6qC1Kxz.png', 'WBJt1DS.png', 'XYo6Cn1.png', 'AD1in1n.png', '6qC1Kxz.png', 'wkBWLdf.png']17interpretation='default'18enable_queue=True19 20gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()