vobecant
commited on
Commit
·
b0beb39
1
Parent(s):
525f14a
Initial commit.
Browse files- .idea/workspace.xml +10 -2
- app.py +9 -6
.idea/workspace.xml
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
<project version="4">
|
3 |
<component name="ChangeListManager">
|
4 |
<list default="true" id="5dd22f22-8223-4d55-99f9-57d1e00622d7" name="Default Changelist" comment="Initial commit.">
|
|
|
5 |
<change beforePath="$PROJECT_DIR$/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/app.py" afterDir="false" />
|
6 |
</list>
|
7 |
<option name="SHOW_DIALOG" value="false" />
|
@@ -50,7 +51,7 @@
|
|
50 |
<option name="number" value="Default" />
|
51 |
<option name="presentableId" value="Default" />
|
52 |
<updated>1647350746642</updated>
|
53 |
-
<workItem from="1647350750956" duration="
|
54 |
</task>
|
55 |
<task id="LOCAL-00001" summary="Initial commit.">
|
56 |
<created>1647352693910</created>
|
@@ -199,7 +200,14 @@
|
|
199 |
<option name="project" value="LOCAL" />
|
200 |
<updated>1647358382116</updated>
|
201 |
</task>
|
202 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
<servers />
|
204 |
</component>
|
205 |
<component name="TypeScriptGeneratedFilesManager">
|
|
|
2 |
<project version="4">
|
3 |
<component name="ChangeListManager">
|
4 |
<list default="true" id="5dd22f22-8223-4d55-99f9-57d1e00622d7" name="Default Changelist" comment="Initial commit.">
|
5 |
+
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
6 |
<change beforePath="$PROJECT_DIR$/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/app.py" afterDir="false" />
|
7 |
</list>
|
8 |
<option name="SHOW_DIALOG" value="false" />
|
|
|
51 |
<option name="number" value="Default" />
|
52 |
<option name="presentableId" value="Default" />
|
53 |
<updated>1647350746642</updated>
|
54 |
+
<workItem from="1647350750956" duration="7770000" />
|
55 |
</task>
|
56 |
<task id="LOCAL-00001" summary="Initial commit.">
|
57 |
<created>1647352693910</created>
|
|
|
200 |
<option name="project" value="LOCAL" />
|
201 |
<updated>1647358382116</updated>
|
202 |
</task>
|
203 |
+
<task id="LOCAL-00022" summary="Initial commit.">
|
204 |
+
<created>1647358512837</created>
|
205 |
+
<option name="number" value="00022" />
|
206 |
+
<option name="presentableId" value="LOCAL-00022" />
|
207 |
+
<option name="project" value="LOCAL" />
|
208 |
+
<updated>1647358512837</updated>
|
209 |
+
</task>
|
210 |
+
<option name="localTasksCounter" value="23" />
|
211 |
<servers />
|
212 |
</component>
|
213 |
<component name="TypeScriptGeneratedFilesManager">
|
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
import requests
|
@@ -47,10 +49,10 @@ def download_file_from_google_drive(destination=WEIGHTS):
|
|
47 |
|
48 |
|
49 |
def download_weights():
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
|
56 |
def segment_segmenter(image, model, window_size, window_stride, encoder_features=False, decoder_features=False,
|
@@ -139,9 +141,10 @@ def predict(input_img):
|
|
139 |
drawing_pseudo = colorize_one(segmentation_remap)
|
140 |
drawing_cs = map2cs(segmentation_remap)
|
141 |
|
142 |
-
drawing_pseudo = transforms.ToPILImage()(drawing_pseudo)
|
143 |
drawing_cs = transforms.ToPILImage()(drawing_cs)
|
144 |
-
return drawing_pseudo, drawing_cs
|
|
|
145 |
|
146 |
|
147 |
title = "Drive&Segment"
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
import gradio as gr
|
4 |
import numpy as np
|
5 |
import requests
|
|
|
49 |
|
50 |
|
51 |
def download_weights():
|
52 |
+
if not os.path.exists(WEIGHTS):
|
53 |
+
url = 'https://data.ciirc.cvut.cz/public/projects/2022DriveAndSegment/segmenter.pth'
|
54 |
+
import urllib.request
|
55 |
+
urllib.request.urlretrieve(url, WEIGHTS)
|
56 |
|
57 |
|
58 |
def segment_segmenter(image, model, window_size, window_stride, encoder_features=False, decoder_features=False,
|
|
|
141 |
drawing_pseudo = colorize_one(segmentation_remap)
|
142 |
drawing_cs = map2cs(segmentation_remap)
|
143 |
|
144 |
+
# drawing_pseudo = transforms.ToPILImage()(drawing_pseudo)
|
145 |
drawing_cs = transforms.ToPILImage()(drawing_cs)
|
146 |
+
# return drawing_pseudo, drawing_cs
|
147 |
+
return drawing_cs
|
148 |
|
149 |
|
150 |
title = "Drive&Segment"
|