Spaces:
Sleeping
Sleeping
Commit
•
3ad5e08
1
Parent(s):
253c253
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
2 |
from fastai.vision.all import*
|
3 |
import gradio as gr
|
4 |
|
5 |
def ECG(x):
|
6 |
return x[0].isupper()
|
7 |
|
8 |
-
|
9 |
import pathlib
|
10 |
temp = pathlib.PosixPath
|
11 |
pathlib.PosixPath = pathlib.WindowsPath
|
@@ -13,12 +18,15 @@ from pathlib import Path
|
|
13 |
|
14 |
learn = load_learner(str(Path('model1.pkl')))
|
15 |
|
|
|
|
|
16 |
categories = ('bradycardia','tachycardia')
|
17 |
|
18 |
def classify_image(img):
|
19 |
pred,idx,probs = learn.predict(img)
|
20 |
return dict(zip(categories, map(float,probs)))
|
21 |
|
|
|
22 |
image = gr.inputs.Image(shape=(192,192))
|
23 |
label = gr.outputs.Label()
|
24 |
examples = ['bradycardia-ECG.jpg']
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['temp', 'learn', 'categories', 'image', 'label', 'examples', 'iface', 'ECG', 'classify_image']
|
5 |
+
|
6 |
+
# %% ../app.ipynb 2
|
7 |
from fastai.vision.all import*
|
8 |
import gradio as gr
|
9 |
|
10 |
def ECG(x):
|
11 |
return x[0].isupper()
|
12 |
|
13 |
+
# %% ../app.ipynb 4
|
14 |
import pathlib
|
15 |
temp = pathlib.PosixPath
|
16 |
pathlib.PosixPath = pathlib.WindowsPath
|
|
|
18 |
|
19 |
learn = load_learner(str(Path('model1.pkl')))
|
20 |
|
21 |
+
|
22 |
+
# %% ../app.ipynb 6
|
23 |
categories = ('bradycardia','tachycardia')
|
24 |
|
25 |
def classify_image(img):
|
26 |
pred,idx,probs = learn.predict(img)
|
27 |
return dict(zip(categories, map(float,probs)))
|
28 |
|
29 |
+
# %% ../app.ipynb 8
|
30 |
image = gr.inputs.Image(shape=(192,192))
|
31 |
label = gr.outputs.Label()
|
32 |
examples = ['bradycardia-ECG.jpg']
|