Spaces:
Sleeping
Sleeping
Toptopito
commited on
Commit
·
212372e
1
Parent(s):
17745fc
path fixes
Browse files- app.py +6 -11
- requirements.txt +1 -2
app.py
CHANGED
@@ -2,16 +2,11 @@ import gradio as gr
|
|
2 |
|
3 |
from fastai.vision.all import *
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
plt = platform.system()
|
9 |
-
if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath
|
10 |
-
else: pathlib.WindowsPath = pathlib.PosixPath
|
11 |
|
12 |
|
13 |
# load model
|
14 |
-
learn = load_learner('
|
15 |
|
16 |
categories = ('CLEAR', 'PNEUMONIA')
|
17 |
|
@@ -19,10 +14,10 @@ def classify_image(img):
|
|
19 |
pred, idx, probs = learn.predict(img)
|
20 |
return dict(zip(categories, map(float, probs)))
|
21 |
|
22 |
-
examples = ['
|
23 |
-
'
|
24 |
-
'
|
25 |
-
'
|
26 |
|
27 |
intf = gr.Interface(fn=classify_image, inputs=gr.Image(type='pil'), outputs=gr.Label(), examples=examples)
|
28 |
|
|
|
2 |
|
3 |
from fastai.vision.all import *
|
4 |
|
5 |
+
cur_path = Path('.')
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
|
8 |
# load model
|
9 |
+
learn = load_learner('model.pkl')
|
10 |
|
11 |
categories = ('CLEAR', 'PNEUMONIA')
|
12 |
|
|
|
14 |
pred, idx, probs = learn.predict(img)
|
15 |
return dict(zip(categories, map(float, probs)))
|
16 |
|
17 |
+
examples = ['unseen_data/NORMAL/NORMAL2-IM-1427-0001.jpeg',
|
18 |
+
'unseen_data/PNEUMONIA/person1946_bacteria_4874.jpeg',
|
19 |
+
'unseen_data/NORMAL/NORMAL2-IM-1430-0001.jpeg',
|
20 |
+
'unseen_data\PNEUMONIA\person1946_bacteria_4875.jpeg']
|
21 |
|
22 |
intf = gr.Interface(fn=classify_image, inputs=gr.Image(type='pil'), outputs=gr.Label(), examples=examples)
|
23 |
|
requirements.txt
CHANGED
@@ -2,5 +2,4 @@ fastai
|
|
2 |
torch
|
3 |
gradio
|
4 |
numpy
|
5 |
-
pandas <2.0.0
|
6 |
-
pathlib
|
|
|
2 |
torch
|
3 |
gradio
|
4 |
numpy
|
5 |
+
pandas <2.0.0
|
|