Anthony-Ml commited on
Commit
a46480e
1 Parent(s): 71ab2c2

Updated app.py

Browse files
Files changed (2) hide show
  1. app.py +3 -1
  2. app.py.bak +21 -0
app.py CHANGED
@@ -12,7 +12,9 @@ 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/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
 
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 = [
16
+ ['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'],
17
+ ['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']]
18
  article="<p style='text-align: center'><a href='https://www.kaggle.com/datasets/anasmohammedtahir/covidqu' target='_blank'>COVID-QU-Ex Dataset</a></p>"
19
  interpretation='default'
20
  enable_queue=True
app.py.bak ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
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
+
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/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
19
+
20
+ gr.Interface(fn=predict_image, inputs=gr.Image(shape=(224,224)),
21
+ outputs = gr.Label(num_top_classes=3),title=title,description=description,examples=examples,article=article, interpretation=interpretation,enable_queue=enable_queue).launch(share=False)