Spaces:
Runtime error
Runtime error
elay018
commited on
Commit
•
08ee717
1
Parent(s):
63da41f
Add main files
Browse files- app.py +19 -0
- export.pkl +3 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
from pathlib import Path
|
3 |
+
import gradio as gr
|
4 |
+
import skimage
|
5 |
+
|
6 |
+
path = Path('export.pkl')
|
7 |
+
learn_inf = load_learner(path)
|
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 |
+
title = "Pneumonia Classification using Pulmonary X-Ray Images"
|
15 |
+
description = "An app designed to classify and distinguish between x-ray images of bacterial pneumonia, viral pneumonia and pulmonary health. Developed using the FastAI library and the V7 Lab COVID-19 X-Ray Dataset."
|
16 |
+
examples = ['xray_1.png']
|
17 |
+
enable_queue = True
|
18 |
+
|
19 |
+
gr.Interface(fn = predict, inputs = gr.inputs.Image(shape = (512, 512)), outputs = gr.outputs.Label(num_top_classes = 3), title = title, description = description, examples = examples, enable_queue = True).launch(share=True)
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a1667d9690f4e522ca9ac32d97b4e95a96e36c0703ad23e710b14afa10759a37
|
3 |
+
size 46994159
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|