joortif commited on
Commit
2933508
verified
1 Parent(s): 41a2fe1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -2,8 +2,24 @@ from huggingface_hub import from_pretrained_fastai
2
  import gradio as gr
3
  from fastai.vision.all import *
4
 
 
 
 
 
 
 
 
5
 
6
 
 
 
 
 
 
 
 
 
 
7
 
8
  repo_id = "joortif/Practica3"
9
 
 
2
  import gradio as gr
3
  from fastai.vision.all import *
4
 
5
+ class TargetMaskConvertTransform(ItemTransform):
6
+ def __init__(self):
7
+ pass
8
+ def encodes(self, x):
9
+ img,mask = x
10
+ mask = np.array(mask)
11
+ new_mask = np.zeros_like(mask, dtype=np.uint8)
12
 
13
 
14
+ new_mask[mask==150]=1 #Clase Leaves
15
+ new_mask[(mask==29) | (mask==25)]=2 #Clase Wood
16
+ new_mask[(mask==74) | (mask==76)]=3 #Clase Pole
17
+ new_mask[mask==255]=4 #Clase Wood
18
+
19
+
20
+ mask = PILMask.create(new_mask)
21
+ return img, mask
22
+
23
 
24
  repo_id = "joortif/Practica3"
25