Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -28,15 +28,18 @@ def edit_file(file, loop_count, speed_factor, frame_skip):
|
|
28 |
frames.append(frame.copy())
|
29 |
durations.append(original_duration // speed_factor) # 再生速度調整
|
30 |
|
31 |
-
#
|
|
|
|
|
|
|
32 |
output_path = f"{base_name}_edited.gif"
|
33 |
frames[0].save(
|
34 |
output_path,
|
35 |
save_all=True,
|
36 |
append_images=frames[1:],
|
37 |
-
loop=
|
38 |
duration=durations,
|
39 |
-
disposal=2
|
40 |
)
|
41 |
|
42 |
return output_path, output_path
|
|
|
28 |
frames.append(frame.copy())
|
29 |
durations.append(original_duration // speed_factor) # 再生速度調整
|
30 |
|
31 |
+
# ループ回数の調整
|
32 |
+
adjusted_loop_count = max(0, loop_count - 1) # GIFのループ設定に合わせる
|
33 |
+
|
34 |
+
# 保存
|
35 |
output_path = f"{base_name}_edited.gif"
|
36 |
frames[0].save(
|
37 |
output_path,
|
38 |
save_all=True,
|
39 |
append_images=frames[1:],
|
40 |
+
loop=adjusted_loop_count, # 調整後のループ回数
|
41 |
duration=durations,
|
42 |
+
disposal=2
|
43 |
)
|
44 |
|
45 |
return output_path, output_path
|