Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,32 @@ from huggingface_hub import from_pretrained_fastai
|
|
2 |
import gradio as gr
|
3 |
from fastai.vision.all import *
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
class TargetMaskConvertTransform(ItemTransform):
|
6 |
def __init__(self):
|
7 |
pass
|
|
|
2 |
import gradio as gr
|
3 |
from fastai.vision.all import *
|
4 |
|
5 |
+
from albumentations import (
|
6 |
+
Compose,
|
7 |
+
OneOf,
|
8 |
+
ElasticTransform,
|
9 |
+
GridDistortion,
|
10 |
+
OpticalDistortion,
|
11 |
+
HorizontalFlip,
|
12 |
+
Rotate,
|
13 |
+
Transpose,
|
14 |
+
CLAHE,
|
15 |
+
ShiftScaleRotate,
|
16 |
+
RandomBrightnessContrast,
|
17 |
+
GaussNoise
|
18 |
+
)
|
19 |
+
|
20 |
+
class SegmentationAlbumentationsTransform(ItemTransform):
|
21 |
+
split_idx = 0
|
22 |
+
|
23 |
+
def __init__(self, aug):
|
24 |
+
self.aug = aug
|
25 |
+
|
26 |
+
def encodes(self, x):
|
27 |
+
img,mask = x
|
28 |
+
aug = self.aug(image=np.array(img), mask=np.array(mask))
|
29 |
+
return PILImage.create(aug["image"]), PILMask.create(aug["mask"])
|
30 |
+
|
31 |
class TargetMaskConvertTransform(ItemTransform):
|
32 |
def __init__(self):
|
33 |
pass
|