Daoneeee commited on
Commit
adf255e
1 Parent(s): bfab9bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -22
app.py CHANGED
@@ -8,33 +8,34 @@ import tensorflow as tf
8
  from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
9
 
10
  feature_extractor = SegformerFeatureExtractor.from_pretrained(
11
- "nvidia/segformer-b0-finetuned-cityscapes-1024-1024"
12
  )
13
  model = TFSegformerForSemanticSegmentation.from_pretrained(
14
- "nvidia/segformer-b0-finetuned-cityscapes-1024-1024"
15
  )
16
 
17
  def ade_palette():
18
  """ADE20K palette that maps each class to RGB values."""
19
  return [
20
- [34, 116, 28],
21
- [84, 57, 0],
22
- [48, 0, 0],
23
- [0, 0, 0],
24
- [70, 65, 217],
25
- [117, 76, 0],
26
- [0, 33, 135],
27
- [255, 255, 255],
28
- [66, 39, 0],
29
- [240, 100, 39],
30
- [256, 236, 197],
31
- [256, 236, 197],
32
- [256, 236, 197],
33
- [256, 236, 197],
34
- [256, 236, 197],
35
- [256, 236, 197],
36
- [51, 51, 51],
37
- [206, 114, 61],
 
38
  ]
39
 
40
  labels_list = []
@@ -103,8 +104,8 @@ def sepia(input_img):
103
  demo = gr.Interface(fn=sepia,
104
  inputs=gr.Image(shape=(400, 600)),
105
  outputs=['plot'],
106
- examples=["person-1.jpg", "person-2.jpg", "person-3.jpg", "person-4.jpg", "person-5.jpg"],
107
  allow_flagging='never')
108
 
109
 
110
- demo.launch()
 
8
  from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
9
 
10
  feature_extractor = SegformerFeatureExtractor.from_pretrained(
11
+ "nvidia/segformer-b1-finetuned-cityscapes-1024-1024"
12
  )
13
  model = TFSegformerForSemanticSegmentation.from_pretrained(
14
+ "nvidia/segformer-b1-finetuned-cityscapes-1024-1024"
15
  )
16
 
17
  def ade_palette():
18
  """ADE20K palette that maps each class to RGB values."""
19
  return [
20
+ [204, 87, 92],
21
+ [112, 185, 212],
22
+ [45, 189, 106],
23
+ [234, 123, 67],
24
+ [78, 56, 123],
25
+ [210, 32, 89],
26
+ [90, 180, 56],
27
+ [155, 102, 200],
28
+ [33, 147, 176],
29
+ [255, 183, 76],
30
+ [67, 123, 89],
31
+ [190, 60, 45],
32
+ [134, 112, 200],
33
+ [56, 45, 189],
34
+ [200, 56, 123],
35
+ [87, 92, 204],
36
+ [120, 56, 123],
37
+ [45, 78, 123],
38
+ [156, 200, 56]
39
  ]
40
 
41
  labels_list = []
 
104
  demo = gr.Interface(fn=sepia,
105
  inputs=gr.Image(shape=(400, 600)),
106
  outputs=['plot'],
107
+ examples=["img_1.jpg", "img_2.jpeg", "img_3.jpg", "img_4.jpg", "img_5.png"],
108
  allow_flagging='never')
109
 
110
 
111
+ demo.launch()