Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,12 @@
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
-
def
|
5 |
-
image_path = path_image_combined / (row['id_code'])
|
6 |
-
transformed_image = custom_transform(image_path)
|
7 |
-
|
8 |
-
# Check the label of the current image and apply augmentations if it belongs to the minority class
|
9 |
-
if not is_test and row['label'] == 1:
|
10 |
-
transformed_image = additional_augmentations(transformed_image)
|
11 |
-
|
12 |
-
return Image.fromarray(transformed_image)
|
13 |
-
pass
|
14 |
-
|
15 |
-
def get_y(row):
|
16 |
-
return row['label'] # adjust this depending on how your csv is structured
|
17 |
-
pass
|
18 |
|
19 |
learn = load_learner('your_model.pkl')
|
20 |
|
21 |
categories = ('Glaucoma Present','Glaucoma Absent')
|
22 |
|
23 |
-
labels = learn.dls.vocab
|
24 |
def predict(img):
|
25 |
pred,pred_idx,probs = learn.predict(img)
|
26 |
return dict(zip(categories, map(float,probs)))
|
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
def is_glaucoma(x): return x[0].isupper()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
learn = load_learner('your_model.pkl')
|
7 |
|
8 |
categories = ('Glaucoma Present','Glaucoma Absent')
|
9 |
|
|
|
10 |
def predict(img):
|
11 |
pred,pred_idx,probs = learn.predict(img)
|
12 |
return dict(zip(categories, map(float,probs)))
|