CoolFace
Apppublic

dpv/Stage1Recycling

sourceHugging Faceupdated 4y agoView on Hugging Face
1likes
app.py16 linesDownload Raw Back to root
1from fastai.vision.all import*2import gradio as gr3learn1 = load_learner('stage1.pkl')4 5categories1 = 'discarded clothing', 'food waste', 'plastic bags', 'recyc_no_scrap', 'scrap metal piece', 'wood scraps'6 7 8def classify_stage1(img):9    pred, idx, probs = learn1.predict(img)10    return dict(zip(categories1, map(float,probs)))11 12image1 = gr.inputs.Image(shape=(192,192))13label1 = gr.outputs.Label()14examples1 = ['stage1ex1_t.jpeg', 'stage1ex2_t.jpeg','stage1ex3_t.jpeg','stage1ex4_t.jpeg', 'stage1ex5_t.jpeg','stage1ex6_t.jpeg']15intf1 = gr.Interface(fn=classify_stage1, inputs = image1, outputs = label1, examples = examples1)16intf1.launch(inline=False)