Spaces:
Runtime error
Runtime error
Arun Prakash commited on
Commit ·
fe40083
1
Parent(s): 8fbf568
covidapp
Browse files- COVID-100.png +0 -0
- COVID-103.png +0 -0
- app.py +31 -0
- export_covid.pkl +3 -0
- normal_5007.png +0 -0
- normal_5014.png +0 -0
- requirements.txt +4 -0
COVID-100.png
ADDED
|
COVID-103.png
ADDED
|
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
|
| 4 |
+
learn = load_learner("export_covid.pkl")
|
| 5 |
+
|
| 6 |
+
labels = learn.dls.vocab
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def predict(img):
|
| 10 |
+
img = PILImage.create(img)
|
| 11 |
+
pred, pred_idx, probs = learn.predict(img)
|
| 12 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
title = "Covid Classifier from X-ray Images"
|
| 16 |
+
description = "Covid Classifier from X-ray Image trained with downloaded data from internet. Created as a demo for Gradio and HuggingFace Spaces."
|
| 17 |
+
|
| 18 |
+
examples = ["COVID-100.png", "COVID-103.png", "normal_5007.png", "normal_5014.png"]
|
| 19 |
+
interpretation = "default"
|
| 20 |
+
enable_queue = True
|
| 21 |
+
|
| 22 |
+
gr.Interface(
|
| 23 |
+
fn=predict,
|
| 24 |
+
inputs=gr.inputs.Image(shape=(512, 512)),
|
| 25 |
+
outputs=gr.outputs.Label(num_top_classes=2),
|
| 26 |
+
title=title,
|
| 27 |
+
description=description,
|
| 28 |
+
examples=examples,
|
| 29 |
+
interpretation=interpretation,
|
| 30 |
+
enable_queue=enable_queue,
|
| 31 |
+
).launch(share=False)
|
export_covid.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:23fc9e322e533bb36698b8914460b213e1dbc82696bc66b9b8c55ebf79d76e7f
|
| 3 |
+
size 87510507
|
normal_5007.png
ADDED
|
normal_5014.png
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
nltk
|
| 3 |
+
scikit-learn
|
| 4 |
+
pickle
|