Spaces:
Running
Running
Nunzio commited on
Commit ·
0930734
1
Parent(s): 7ba72fb
final commit
Browse files
app.py
CHANGED
|
@@ -12,12 +12,12 @@ turin_image_dir = "./preloadedImages/turin"
|
|
| 12 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 13 |
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
image_list = loadPreloadedImages(gta_image_dir, city_image_dir, turin_image_dir)
|
| 23 |
|
|
@@ -86,12 +86,12 @@ with gr.Blocks(title="Semantic Segmentation Predictors") as demo:
|
|
| 86 |
with gr.Column(scale=1):
|
| 87 |
color_box0 = f"""<span style='display:inline-block; width:15px; height:15px;
|
| 88 |
background-color:rgb({legend[i][3][0]},{legend[i][3][1]},{legend[i][3][2]}); margin-left:6px; border:1px solid #000;'></span>"""
|
| 89 |
-
gr.HTML(f"<div style='display:flex; align-items:center; margin-bottom:-5px;'><b>{legend[i][1]}</b> → {color_box0}</div>")
|
| 90 |
with gr.Column(scale=1):
|
| 91 |
if i + 1 < len(legend):
|
| 92 |
color_box1 = f"""<span style='display:inline-block; width:15px; height:15px;
|
| 93 |
background-color:rgb({legend[i+1][3][0]},{legend[i+1][3][1]},{legend[i+1][3][2]}); margin-left:6px; border:1px solid #000;'></span>"""
|
| 94 |
-
gr.HTML(f"<div style='display:flex; align-items:center; margin-bottom:-5px;'><b>{legend[i+1][1]}</b> → {color_box1}</div>")
|
| 95 |
else:
|
| 96 |
gr.Markdown("")
|
| 97 |
|
|
|
|
| 12 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 13 |
|
| 14 |
|
| 15 |
+
MODELS = {
|
| 16 |
+
"BISENET-BASE": loadModel('bisenet', device, 'weight_Base.pth'),
|
| 17 |
+
"BISENET-BEST": loadModel('bisenet', device, 'weight_Best.pth'),
|
| 18 |
+
"BISENETV2-BASE": loadModel('bisenetv2', device, 'weight_Base.pth'),
|
| 19 |
+
"BISENETV2-BEST": loadModel('bisenetv2', device, 'weight_Best.pth')
|
| 20 |
+
}
|
| 21 |
|
| 22 |
image_list = loadPreloadedImages(gta_image_dir, city_image_dir, turin_image_dir)
|
| 23 |
|
|
|
|
| 86 |
with gr.Column(scale=1):
|
| 87 |
color_box0 = f"""<span style='display:inline-block; width:15px; height:15px;
|
| 88 |
background-color:rgb({legend[i][3][0]},{legend[i][3][1]},{legend[i][3][2]}); margin-left:6px; border:1px solid #000;'></span>"""
|
| 89 |
+
gr.HTML(f"<div style='display:flex; align-items:center; margin-bottom:-10px; margin-top:-5px;'><b>{legend[i][1]}</b> → {color_box0}</div>")
|
| 90 |
with gr.Column(scale=1):
|
| 91 |
if i + 1 < len(legend):
|
| 92 |
color_box1 = f"""<span style='display:inline-block; width:15px; height:15px;
|
| 93 |
background-color:rgb({legend[i+1][3][0]},{legend[i+1][3][1]},{legend[i+1][3][2]}); margin-left:6px; border:1px solid #000;'></span>"""
|
| 94 |
+
gr.HTML(f"<div style='display:flex; align-items:center; margin-bottom:-10px; margin-top:-5px;'><b>{legend[i+1][1]}</b> → {color_box1}</div>")
|
| 95 |
else:
|
| 96 |
gr.Markdown("")
|
| 97 |
|