Spaces:
Running
on
T4
Running
on
T4
DeepBeepMeep
commited on
Commit
·
d6835bd
1
Parent(s):
d290612
fixed bugs
Browse files- gradio_server.py +11 -10
- rife/inference.py +2 -2
gradio_server.py
CHANGED
|
@@ -1773,7 +1773,6 @@ def generate_video(
|
|
| 1773 |
# yield f"Video generation was aborted. Total Generation Time: {end_time-start_time:.1f}s"
|
| 1774 |
else:
|
| 1775 |
sample = samples.cpu()
|
| 1776 |
-
# video = rearrange(sample.cpu().numpy(), "c t h w -> t h w c")
|
| 1777 |
|
| 1778 |
time_flag = datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d-%Hh%Mm%Ss")
|
| 1779 |
if os.name == 'nt':
|
|
@@ -1782,14 +1781,14 @@ def generate_video(
|
|
| 1782 |
file_name = f"{time_flag}_seed{seed}_{sanitize_file_name(prompt[:100]).strip()}.mp4"
|
| 1783 |
video_path = os.path.join(save_path, file_name)
|
| 1784 |
# if False: # for testing
|
| 1785 |
-
# torch.save(sample, "
|
| 1786 |
# else:
|
| 1787 |
-
# sample =torch.load("
|
| 1788 |
exp = 0
|
| 1789 |
fps = 16
|
| 1790 |
|
| 1791 |
if len(temporal_upsampling) > 0 or len(spatial_upsampling) > 0:
|
| 1792 |
-
progress_args = [
|
| 1793 |
progress(*progress_args )
|
| 1794 |
gen["progress_args"] = progress_args
|
| 1795 |
|
|
@@ -1804,7 +1803,7 @@ def generate_video(
|
|
| 1804 |
fps = fps * 2**exp
|
| 1805 |
|
| 1806 |
if len(spatial_upsampling) > 0:
|
| 1807 |
-
from wan.utils.utils import resize_lanczos
|
| 1808 |
if spatial_upsampling == "lanczos1.5":
|
| 1809 |
scale = 1.5
|
| 1810 |
else:
|
|
@@ -2712,10 +2711,12 @@ def generate_video_tab(image2video=False):
|
|
| 2712 |
queue_df = gr.DataFrame(
|
| 2713 |
headers=["Qty","Prompt", "Length","Steps","Start", "End", "", "", ""],
|
| 2714 |
datatype=[ "str","markdown","str", "markdown", "markdown", "markdown", "str", "str", "str"],
|
|
|
|
| 2715 |
interactive=False,
|
| 2716 |
col_count=(9, "fixed"),
|
| 2717 |
wrap=True,
|
| 2718 |
value=[],
|
|
|
|
| 2719 |
visible= False,
|
| 2720 |
# every=1,
|
| 2721 |
elem_id="queue_df"
|
|
@@ -3266,15 +3267,16 @@ def create_demo():
|
|
| 3266 |
pointer-events: none;
|
| 3267 |
text-align: center;
|
| 3268 |
vertical-align: middle;
|
|
|
|
| 3269 |
}
|
| 3270 |
-
#
|
| 3271 |
width: 100%;
|
| 3272 |
overflow: hidden !important;
|
| 3273 |
}
|
| 3274 |
-
#
|
| 3275 |
display: none !important;
|
| 3276 |
}
|
| 3277 |
-
#
|
| 3278 |
scrollbar-width: none !important;
|
| 3279 |
-ms-overflow-style: none !important;
|
| 3280 |
}
|
|
@@ -3292,9 +3294,8 @@ def create_demo():
|
|
| 3292 |
cursor: default !important;
|
| 3293 |
pointer-events: none;
|
| 3294 |
}
|
| 3295 |
-
#
|
| 3296 |
#queue_df td:nth-child(2) {
|
| 3297 |
-
width: auto;
|
| 3298 |
text-align: center;
|
| 3299 |
vertical-align: middle;
|
| 3300 |
white-space: normal;
|
|
|
|
| 1773 |
# yield f"Video generation was aborted. Total Generation Time: {end_time-start_time:.1f}s"
|
| 1774 |
else:
|
| 1775 |
sample = samples.cpu()
|
|
|
|
| 1776 |
|
| 1777 |
time_flag = datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d-%Hh%Mm%Ss")
|
| 1778 |
if os.name == 'nt':
|
|
|
|
| 1781 |
file_name = f"{time_flag}_seed{seed}_{sanitize_file_name(prompt[:100]).strip()}.mp4"
|
| 1782 |
video_path = os.path.join(save_path, file_name)
|
| 1783 |
# if False: # for testing
|
| 1784 |
+
# torch.save(sample, "output.pt")
|
| 1785 |
# else:
|
| 1786 |
+
# sample =torch.load("output.pt")
|
| 1787 |
exp = 0
|
| 1788 |
fps = 16
|
| 1789 |
|
| 1790 |
if len(temporal_upsampling) > 0 or len(spatial_upsampling) > 0:
|
| 1791 |
+
progress_args = [(num_inference_steps , num_inference_steps) , status + " - Upsampling" , num_inference_steps]
|
| 1792 |
progress(*progress_args )
|
| 1793 |
gen["progress_args"] = progress_args
|
| 1794 |
|
|
|
|
| 1803 |
fps = fps * 2**exp
|
| 1804 |
|
| 1805 |
if len(spatial_upsampling) > 0:
|
| 1806 |
+
from wan.utils.utils import resize_lanczos # need multithreading or to do lanczos with cuda
|
| 1807 |
if spatial_upsampling == "lanczos1.5":
|
| 1808 |
scale = 1.5
|
| 1809 |
else:
|
|
|
|
| 2711 |
queue_df = gr.DataFrame(
|
| 2712 |
headers=["Qty","Prompt", "Length","Steps","Start", "End", "", "", ""],
|
| 2713 |
datatype=[ "str","markdown","str", "markdown", "markdown", "markdown", "str", "str", "str"],
|
| 2714 |
+
column_widths= ["50","", "65","55", "60", "60", "30", "30", "35"],
|
| 2715 |
interactive=False,
|
| 2716 |
col_count=(9, "fixed"),
|
| 2717 |
wrap=True,
|
| 2718 |
value=[],
|
| 2719 |
+
line_breaks= True,
|
| 2720 |
visible= False,
|
| 2721 |
# every=1,
|
| 2722 |
elem_id="queue_df"
|
|
|
|
| 3267 |
pointer-events: none;
|
| 3268 |
text-align: center;
|
| 3269 |
vertical-align: middle;
|
| 3270 |
+
font-size:11px;
|
| 3271 |
}
|
| 3272 |
+
#xqueue_df table {
|
| 3273 |
width: 100%;
|
| 3274 |
overflow: hidden !important;
|
| 3275 |
}
|
| 3276 |
+
#xqueue_df::-webkit-scrollbar {
|
| 3277 |
display: none !important;
|
| 3278 |
}
|
| 3279 |
+
#xqueue_df {
|
| 3280 |
scrollbar-width: none !important;
|
| 3281 |
-ms-overflow-style: none !important;
|
| 3282 |
}
|
|
|
|
| 3294 |
cursor: default !important;
|
| 3295 |
pointer-events: none;
|
| 3296 |
}
|
| 3297 |
+
#xqueue_df th:nth-child(2),
|
| 3298 |
#queue_df td:nth-child(2) {
|
|
|
|
| 3299 |
text-align: center;
|
| 3300 |
vertical-align: middle;
|
| 3301 |
white-space: normal;
|
rife/inference.py
CHANGED
|
@@ -73,7 +73,7 @@ def process_frames(model, device, frames, exp):
|
|
| 73 |
ssim = ssim_matlab(I0_small[:, :3], I1_small[:, :3])
|
| 74 |
|
| 75 |
break_flag = False
|
| 76 |
-
if ssim > 0.996:
|
| 77 |
pos += 1
|
| 78 |
frame = get_frame(frames, pos)
|
| 79 |
if frame is None:
|
|
@@ -86,7 +86,7 @@ def process_frames(model, device, frames, exp):
|
|
| 86 |
I1 = model.inference(I0, I1, scale)
|
| 87 |
I1_small = F.interpolate(I1, (32, 32), mode='bilinear', align_corners=False)
|
| 88 |
ssim = ssim_matlab(I0_small[:, :3], I1_small[:, :3])
|
| 89 |
-
frame = I1[0]
|
| 90 |
|
| 91 |
if ssim < 0.2:
|
| 92 |
output = []
|
|
|
|
| 73 |
ssim = ssim_matlab(I0_small[:, :3], I1_small[:, :3])
|
| 74 |
|
| 75 |
break_flag = False
|
| 76 |
+
if ssim > 0.996 or pos > 100:
|
| 77 |
pos += 1
|
| 78 |
frame = get_frame(frames, pos)
|
| 79 |
if frame is None:
|
|
|
|
| 86 |
I1 = model.inference(I0, I1, scale)
|
| 87 |
I1_small = F.interpolate(I1, (32, 32), mode='bilinear', align_corners=False)
|
| 88 |
ssim = ssim_matlab(I0_small[:, :3], I1_small[:, :3])
|
| 89 |
+
frame = I1[0][:, :h, :w]
|
| 90 |
|
| 91 |
if ssim < 0.2:
|
| 92 |
output = []
|