Spaces:
Build error
Build error
Update the app file
Browse files- app.py +2 -3
- app.py.bak +22 -0
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
from fastai.vision.all import *
|
3 |
from efficientnet_pytorch import EfficientNet
|
4 |
|
5 |
-
learn = load_learner('predictcovidfastaifinal18102023.pkl')
|
6 |
|
7 |
categories = learn.dls.vocab
|
8 |
|
@@ -12,8 +12,7 @@ def predict_image(get_image):
|
|
12 |
|
13 |
title = "Detect COVID_19 Infection Xray Chest Images"
|
14 |
description = "A covid19 infection classifier trained on the anasmohammedtahir/covidqu dataset with efficientnetb0 base model. Created demo using Gradio and HuggingFace Spaces."
|
15 |
-
examples = ['covid_1038.png', 'covid_1034.png']
|
16 |
-
examples = ['non_COVID (10610).png', 'non_COVID (10609).png']
|
17 |
article="<p style='text-align: center'><a href='https://www.kaggle.com/datasets/anasmohammedtahir/covidqu' target='_blank'>COVID-QU-Ex Dataset</a></p>"
|
18 |
interpretation='default'
|
19 |
enable_queue=True
|
|
|
2 |
from fastai.vision.all import *
|
3 |
from efficientnet_pytorch import EfficientNet
|
4 |
|
5 |
+
learn = load_learner('/model/predictcovidfastaifinal18102023.pkl')
|
6 |
|
7 |
categories = learn.dls.vocab
|
8 |
|
|
|
12 |
|
13 |
title = "Detect COVID_19 Infection Xray Chest Images"
|
14 |
description = "A covid19 infection classifier trained on the anasmohammedtahir/covidqu dataset with efficientnetb0 base model. Created demo using Gradio and HuggingFace Spaces."
|
15 |
+
examples = ['/covid/covid_1038.png', '/covid/covid_1034.png', '/covid/cd.png', '/covid/covid_1021.png', '/covid/covid_1027.png', '/covid/covid_1042.png', '/covid/covid_1031.png']
|
|
|
16 |
article="<p style='text-align: center'><a href='https://www.kaggle.com/datasets/anasmohammedtahir/covidqu' target='_blank'>COVID-QU-Ex Dataset</a></p>"
|
17 |
interpretation='default'
|
18 |
enable_queue=True
|
app.py.bak
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
from efficientnet_pytorch import EfficientNet
|
4 |
+
|
5 |
+
learn = load_learner('predictcovidfastaifinal18102023.pkl')
|
6 |
+
|
7 |
+
categories = learn.dls.vocab
|
8 |
+
|
9 |
+
def predict_image(get_image):
|
10 |
+
pred, idx, probs = learn.predict(get_image)
|
11 |
+
return dict(zip(categories, map(float, probs)))
|
12 |
+
|
13 |
+
title = "Detect COVID_19 Infection Xray Chest Images"
|
14 |
+
description = "A covid19 infection classifier trained on the anasmohammedtahir/covidqu dataset with efficientnetb0 base model. Created demo using Gradio and HuggingFace Spaces."
|
15 |
+
examples = ['covid_1038.png', 'covid_1034.png']
|
16 |
+
examples = ['non_COVID (10610).png', 'non_COVID (10609).png']
|
17 |
+
article="<p style='text-align: center'><a href='https://www.kaggle.com/datasets/anasmohammedtahir/covidqu' target='_blank'>COVID-QU-Ex Dataset</a></p>"
|
18 |
+
interpretation='default'
|
19 |
+
enable_queue=True
|
20 |
+
|
21 |
+
gr.Interface(fn=predict_image, inputs=gr.Image(shape=(224,224)),
|
22 |
+
outputs = gr.Label(num_top_classes=3),title=title,description=description,examples=examples,article=article, interpretation=interpretation,enable_queue=enable_queue).launch(share=False)
|