Spaces:
Build error
Build error
File size: 985 Bytes
92aa748 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from fastai.vision.all import *
learn = load_learner('final_18102023_eb7_model.pkl')
categories = learn.dls.vocab
def predict_image(get_image):
pred, idx, probs = learn.predict(get_image)
return dict(zip(categories, map(float, probs)))
title = "Detect COVID_19 Infection Xray Chest Images"
description = "A covid19 infection classifier trained on the anasmohammedtahir/covidqu dataset with fastai. Created demo using Gradio and HuggingFace Spaces."
examples = ['/content/dataset/val/normal/Normal (10001).png']
article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>COVID-QU-Ex Dataset</a></p>"
interpretation='default'
enable_queue=True
gr.Interface(fn=predict_image, inputs=gr.Image(shape=(224,224)),
outputs = gr.Label(num_top_classes=3),title=title,description=description,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch(share=False)
|