Rex Cheng
commited on
Commit
·
d6a6a48
1
Parent(s):
78b4e6b
enable random seed
Browse files
app.py
CHANGED
@@ -64,7 +64,10 @@ def video_to_audio(video: gr.Video, prompt: str, negative_prompt: str, seed: int
|
|
64 |
cfg_strength: float, duration: float):
|
65 |
|
66 |
rng = torch.Generator(device=device)
|
67 |
-
|
|
|
|
|
|
|
68 |
fm = FlowMatching(min_sigma=0, inference_mode='euler', num_steps=num_steps)
|
69 |
|
70 |
video_info = load_video(video, duration)
|
@@ -101,7 +104,10 @@ def text_to_audio(prompt: str, negative_prompt: str, seed: int, num_steps: int,
|
|
101 |
duration: float):
|
102 |
|
103 |
rng = torch.Generator(device=device)
|
104 |
-
|
|
|
|
|
|
|
105 |
fm = FlowMatching(min_sigma=0, inference_mode='euler', num_steps=num_steps)
|
106 |
|
107 |
clip_frames = sync_frames = None
|
@@ -137,7 +143,7 @@ video_to_audio_tab = gr.Interface(
|
|
137 |
gr.Video(),
|
138 |
gr.Text(label='Prompt'),
|
139 |
gr.Text(label='Negative prompt', value='music'),
|
140 |
-
gr.Number(label='Seed', value
|
141 |
gr.Number(label='Num steps', value=25, precision=0, minimum=1),
|
142 |
gr.Number(label='Guidance Strength', value=4.5, minimum=1),
|
143 |
gr.Number(label='Duration (sec)', value=8, minimum=1),
|
|
|
64 |
cfg_strength: float, duration: float):
|
65 |
|
66 |
rng = torch.Generator(device=device)
|
67 |
+
if seed >= 0:
|
68 |
+
rng.manual_seed(seed)
|
69 |
+
else:
|
70 |
+
rng.seed()
|
71 |
fm = FlowMatching(min_sigma=0, inference_mode='euler', num_steps=num_steps)
|
72 |
|
73 |
video_info = load_video(video, duration)
|
|
|
104 |
duration: float):
|
105 |
|
106 |
rng = torch.Generator(device=device)
|
107 |
+
if seed >= 0:
|
108 |
+
rng.manual_seed(seed)
|
109 |
+
else:
|
110 |
+
rng.seed()
|
111 |
fm = FlowMatching(min_sigma=0, inference_mode='euler', num_steps=num_steps)
|
112 |
|
113 |
clip_frames = sync_frames = None
|
|
|
143 |
gr.Video(),
|
144 |
gr.Text(label='Prompt'),
|
145 |
gr.Text(label='Negative prompt', value='music'),
|
146 |
+
gr.Number(label='Seed (-1: random)', value=-1, precision=0, minimum=-1),
|
147 |
gr.Number(label='Num steps', value=25, precision=0, minimum=1),
|
148 |
gr.Number(label='Guidance Strength', value=4.5, minimum=1),
|
149 |
gr.Number(label='Duration (sec)', value=8, minimum=1),
|