Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -963,10 +963,18 @@ def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_wind
|
|
963 |
# Hugging Face Spaces GPU装飾子を使用してプロセス関数を処理
|
964 |
if IN_HF_SPACE and 'spaces' in globals():
|
965 |
@spaces.GPU
|
966 |
-
def process_with_gpu(input_image, prompt, n_prompt, seed, total_second_length,
|
967 |
global stream
|
968 |
assert input_image is not None, '入力画像がありません!'
|
969 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
970 |
# UI状態の初期化
|
971 |
yield None, None, '', '', gr.update(interactive=False), gr.update(interactive=True)
|
972 |
|
@@ -1040,10 +1048,23 @@ if IN_HF_SPACE and 'spaces' in globals():
|
|
1040 |
|
1041 |
process = process_with_gpu
|
1042 |
else:
|
1043 |
-
|
|
|
|
|
|
|
|
|
1044 |
global stream
|
1045 |
assert input_image is not None, '入力画像がありません!'
|
1046 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1047 |
# UI状態の初期化
|
1048 |
yield None, None, '', '', gr.update(interactive=False), gr.update(interactive=True)
|
1049 |
|
@@ -1542,60 +1563,6 @@ with block:
|
|
1542 |
step=0.1
|
1543 |
)
|
1544 |
|
1545 |
-
latent_window_size = gr.Slider(
|
1546 |
-
label="潜在窓サイズ / Latent Window Size",
|
1547 |
-
minimum=1,
|
1548 |
-
maximum=33,
|
1549 |
-
value=9,
|
1550 |
-
step=1,
|
1551 |
-
visible=False
|
1552 |
-
)
|
1553 |
-
|
1554 |
-
steps = gr.Slider(
|
1555 |
-
label="推論ステップ数 / Inference Steps",
|
1556 |
-
minimum=1,
|
1557 |
-
maximum=100,
|
1558 |
-
value=25,
|
1559 |
-
step=1,
|
1560 |
-
info='この値の変更は推奨されません。 / Changing this value is not recommended.'
|
1561 |
-
)
|
1562 |
-
|
1563 |
-
cfg = gr.Slider(
|
1564 |
-
label="CFGスケール / CFG Scale",
|
1565 |
-
minimum=1.0,
|
1566 |
-
maximum=32.0,
|
1567 |
-
value=1.0,
|
1568 |
-
step=0.01,
|
1569 |
-
visible=False
|
1570 |
-
)
|
1571 |
-
|
1572 |
-
gs = gr.Slider(
|
1573 |
-
label="蒸留CFGスケール / Distilled CFG Scale",
|
1574 |
-
minimum=1.0,
|
1575 |
-
maximum=32.0,
|
1576 |
-
value=10.0,
|
1577 |
-
step=0.01,
|
1578 |
-
info='この値の変更は推奨されません。 / Changing this value is not recommended.'
|
1579 |
-
)
|
1580 |
-
|
1581 |
-
rs = gr.Slider(
|
1582 |
-
label="CFGリスケール / CFG Rescale",
|
1583 |
-
minimum=0.0,
|
1584 |
-
maximum=1.0,
|
1585 |
-
value=0.0,
|
1586 |
-
step=0.01,
|
1587 |
-
visible=False
|
1588 |
-
)
|
1589 |
-
|
1590 |
-
gpu_memory_preservation = gr.Slider(
|
1591 |
-
label="GPU推論保存メモリ(GB) / GPU Memory (GB)",
|
1592 |
-
minimum=6,
|
1593 |
-
maximum=128,
|
1594 |
-
value=6,
|
1595 |
-
step=0.1,
|
1596 |
-
info="OOMエラーが発生した場合は、この値を大きくしてください。値が大きいほど処理が遅くなります。 / Set this to a larger value if you encounter OOM errors. Larger values cause slower speed."
|
1597 |
-
)
|
1598 |
-
|
1599 |
# 右側のプレビューと結果カラム
|
1600 |
with gr.Column(scale=1, elem_classes="mobile-full-width"):
|
1601 |
# プレビュー画像
|
@@ -1629,7 +1596,7 @@ with block:
|
|
1629 |
error_message = gr.HTML('', elem_id='error-message', visible=True)
|
1630 |
|
1631 |
# 処理関数
|
1632 |
-
ips = [input_image, prompt, n_prompt, seed, total_second_length,
|
1633 |
|
1634 |
# 開始と終了ボタンのイベント
|
1635 |
start_button.click(fn=process, inputs=ips, outputs=[result_video, preview_image, progress_desc, progress_bar, start_button, end_button])
|
|
|
963 |
# Hugging Face Spaces GPU装飾子を使用してプロセス関数を処理
|
964 |
if IN_HF_SPACE and 'spaces' in globals():
|
965 |
@spaces.GPU
|
966 |
+
def process_with_gpu(input_image, prompt, n_prompt, seed, total_second_length, use_teacache):
|
967 |
global stream
|
968 |
assert input_image is not None, '入力画像がありません!'
|
969 |
|
970 |
+
latent_window_size = 9
|
971 |
+
steps = 25
|
972 |
+
cfg = 1.0
|
973 |
+
gs = 10.0
|
974 |
+
rs = 0.0
|
975 |
+
gpu_memory_preservation = 6
|
976 |
+
|
977 |
+
|
978 |
# UI状態の初期化
|
979 |
yield None, None, '', '', gr.update(interactive=False), gr.update(interactive=True)
|
980 |
|
|
|
1048 |
|
1049 |
process = process_with_gpu
|
1050 |
else:
|
1051 |
+
|
1052 |
+
|
1053 |
+
|
1054 |
+
|
1055 |
+
def process(input_image, prompt, n_prompt, seed, total_second_length, use_teacache):
|
1056 |
global stream
|
1057 |
assert input_image is not None, '入力画像がありません!'
|
1058 |
|
1059 |
+
latent_window_size = 9
|
1060 |
+
steps = 25
|
1061 |
+
cfg = 1.0
|
1062 |
+
gs = 10.0
|
1063 |
+
rs = 0.0
|
1064 |
+
gpu_memory_preservation = 6
|
1065 |
+
|
1066 |
+
|
1067 |
+
|
1068 |
# UI状態の初期化
|
1069 |
yield None, None, '', '', gr.update(interactive=False), gr.update(interactive=True)
|
1070 |
|
|
|
1563 |
step=0.1
|
1564 |
)
|
1565 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1566 |
# 右側のプレビューと結果カラム
|
1567 |
with gr.Column(scale=1, elem_classes="mobile-full-width"):
|
1568 |
# プレビュー画像
|
|
|
1596 |
error_message = gr.HTML('', elem_id='error-message', visible=True)
|
1597 |
|
1598 |
# 処理関数
|
1599 |
+
ips = [input_image, prompt, n_prompt, seed, total_second_length,use_teacache]
|
1600 |
|
1601 |
# 開始と終了ボタンのイベント
|
1602 |
start_button.click(fn=process, inputs=ips, outputs=[result_video, preview_image, progress_desc, progress_bar, start_button, end_button])
|