Spaces:
Running
Running
Daniel Gil-U Fuhge
commited on
Commit
•
85cd824
1
Parent(s):
a54d9bd
Fix polating model output
Browse files
src/postprocessing/postprocessing.py
CHANGED
@@ -170,6 +170,8 @@ def animate_logo(model_output: pd.DataFrame, logo_path: str):
|
|
170 |
elif animation_type == 3:
|
171 |
# animation: scale
|
172 |
from_f = animations_by_type[animation_type][i][16]
|
|
|
|
|
173 |
# Check if there is a next scale animation
|
174 |
if i < len(animations_by_type[animation_type]) - 1:
|
175 |
# animation endpoint is next scale animation's starting point
|
@@ -181,6 +183,10 @@ def animate_logo(model_output: pd.DataFrame, logo_path: str):
|
|
181 |
elif animation_type == 4:
|
182 |
# animation: rotate
|
183 |
from_degree = animations_by_type[animation_type][i][17]
|
|
|
|
|
|
|
|
|
184 |
# Get midpoints
|
185 |
midpoints = get_midpoint_of_path_bbox(logo_path, animation_id)
|
186 |
# Check if there is a next scale animation
|
@@ -250,6 +256,10 @@ def animate_logo(model_output: pd.DataFrame, logo_path: str):
|
|
250 |
elif animation_type == 8:
|
251 |
# animation: opacity
|
252 |
from_f = animations_by_type[animation_type][i][23] / 100 # percent
|
|
|
|
|
|
|
|
|
253 |
# Check if there is a next opacity animation
|
254 |
if i < len(animations_by_type[animation_type]) - 1:
|
255 |
# animation endpoint is next opacity animation's starting point
|
@@ -261,6 +271,8 @@ def animate_logo(model_output: pd.DataFrame, logo_path: str):
|
|
261 |
elif animation_type == 9:
|
262 |
# animation: blur
|
263 |
from_f = animations_by_type[animation_type][i][24]
|
|
|
|
|
264 |
# Check if there is a next blur animation
|
265 |
if i < len(animations_by_type[animation_type]) - 1:
|
266 |
# animation endpoint is next blur animation's starting point
|
@@ -282,7 +294,7 @@ def animate_logo(model_output: pd.DataFrame, logo_path: str):
|
|
282 |
_insert_animations(total_animations, logo_path, logo_path)
|
283 |
|
284 |
def _convert_to_hex_str(i: int):
|
285 |
-
h = str(hex(i))[2:]
|
286 |
if i < 16:
|
287 |
h = '0' + h
|
288 |
return h
|
|
|
170 |
elif animation_type == 3:
|
171 |
# animation: scale
|
172 |
from_f = animations_by_type[animation_type][i][16]
|
173 |
+
if from_f <= 0:
|
174 |
+
from_f = 0.0000001
|
175 |
# Check if there is a next scale animation
|
176 |
if i < len(animations_by_type[animation_type]) - 1:
|
177 |
# animation endpoint is next scale animation's starting point
|
|
|
183 |
elif animation_type == 4:
|
184 |
# animation: rotate
|
185 |
from_degree = animations_by_type[animation_type][i][17]
|
186 |
+
if from_degree < 0:
|
187 |
+
from_degree = 0
|
188 |
+
elif from_degree > 360:
|
189 |
+
from_degree = 360
|
190 |
# Get midpoints
|
191 |
midpoints = get_midpoint_of_path_bbox(logo_path, animation_id)
|
192 |
# Check if there is a next scale animation
|
|
|
256 |
elif animation_type == 8:
|
257 |
# animation: opacity
|
258 |
from_f = animations_by_type[animation_type][i][23] / 100 # percent
|
259 |
+
if from_f < 0:
|
260 |
+
from_f = 0
|
261 |
+
elif from_f > 1:
|
262 |
+
from_f = 1
|
263 |
# Check if there is a next opacity animation
|
264 |
if i < len(animations_by_type[animation_type]) - 1:
|
265 |
# animation endpoint is next opacity animation's starting point
|
|
|
271 |
elif animation_type == 9:
|
272 |
# animation: blur
|
273 |
from_f = animations_by_type[animation_type][i][24]
|
274 |
+
if from_f <= 0:
|
275 |
+
from_f = 1
|
276 |
# Check if there is a next blur animation
|
277 |
if i < len(animations_by_type[animation_type]) - 1:
|
278 |
# animation endpoint is next blur animation's starting point
|
|
|
294 |
_insert_animations(total_animations, logo_path, logo_path)
|
295 |
|
296 |
def _convert_to_hex_str(i: int):
|
297 |
+
h = str(hex(int(i)))[2:]
|
298 |
if i < 16:
|
299 |
h = '0' + h
|
300 |
return h
|