Spaces:
Runtime error
Runtime error
from fastai.vision.all import * | |
import skimage | |
import gradio as gr | |
def predict(img): | |
pred,pred_idx,probs = learn.predict(img) | |
return {labels[i]: float(probs[i]) for i in range(len(labels))} | |
learn = load_learner('export.pkl') | |
labels = learn.dls.vocab | |
title = "Demodex Blepharitis Classifier" | |
description = "A classifier trained on public images to detect Demodex Blepharitis. (Demo)" | |
# article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>" | |
interpretation = "default" | |
examples = ['projectO/Experiments/phase0/demodex/blepharitis.jpg', | |
'projectO/Experiments/phase0/demodex/demodex.jpg', | |
'projectO/Experiments/phase0/no_demodex/10485-coconut_oil_for_eyelashes_732x549-thumbnail-Recovered-732x549.jpg'] | |
gr.Interface(fn=predict, | |
inputs=gr.inputs.Image(shape=(512, 512)), | |
outputs=gr.outputs.Label(num_top_classes=2), | |
title = title, | |
description = description, | |
# article=article, | |
examples=examples, | |
interpretation=interpretation, | |
enable_queue=True).launch(share=True) |