Spaces:
Running
Running
JacobLinCool
commited on
Commit
•
4a7b229
1
Parent(s):
24caa86
fix: ffmpeg does not overwrite the merged audio
Browse files- app/infer.py +4 -4
- app/train.py +1 -5
app/infer.py
CHANGED
@@ -65,7 +65,7 @@ def merge(exp_dir: str, original_audio: str, vocal: Tuple[int, np.ndarray]) -> s
|
|
65 |
sf.write(tmp, vocal[1], vocal[0])
|
66 |
|
67 |
os.system(
|
68 |
-
f"ffmpeg -i {music} -i {tmp} -filter_complex '[1]volume=2[a];[0][a]amix=inputs=2:duration=first:dropout_transition=2' {tmp}.merged.mp3"
|
69 |
)
|
70 |
|
71 |
return f"{tmp}.merged.mp3"
|
@@ -91,7 +91,7 @@ class InferenceTab:
|
|
91 |
|
92 |
with gr.Column():
|
93 |
self.f0add = gr.Slider(
|
94 |
-
label="F0
|
95 |
minimum=-16,
|
96 |
maximum=16,
|
97 |
step=1,
|
@@ -115,11 +115,11 @@ class InferenceTab:
|
|
115 |
self.infer_btn = gr.Button(value="Infer", variant="primary")
|
116 |
with gr.Row():
|
117 |
self.infer_output = gr.Audio(
|
118 |
-
label="Inferred audio", show_download_button=True
|
119 |
)
|
120 |
with gr.Row():
|
121 |
self.merge_output = gr.Audio(
|
122 |
-
label="Merged audio", show_download_button=True
|
123 |
)
|
124 |
|
125 |
def build(self, exp_dir: gr.Textbox):
|
|
|
65 |
sf.write(tmp, vocal[1], vocal[0])
|
66 |
|
67 |
os.system(
|
68 |
+
f"ffmpeg -i {music} -i {tmp} -filter_complex '[1]volume=2[a];[0][a]amix=inputs=2:duration=first:dropout_transition=2' -ac 2 -y {tmp}.merged.mp3"
|
69 |
)
|
70 |
|
71 |
return f"{tmp}.merged.mp3"
|
|
|
91 |
|
92 |
with gr.Column():
|
93 |
self.f0add = gr.Slider(
|
94 |
+
label="F0 +/-",
|
95 |
minimum=-16,
|
96 |
maximum=16,
|
97 |
step=1,
|
|
|
115 |
self.infer_btn = gr.Button(value="Infer", variant="primary")
|
116 |
with gr.Row():
|
117 |
self.infer_output = gr.Audio(
|
118 |
+
label="Inferred audio", show_download_button=True, format="mp3"
|
119 |
)
|
120 |
with gr.Row():
|
121 |
self.merge_output = gr.Audio(
|
122 |
+
label="Merged audio", show_download_button=True, format="mp3"
|
123 |
)
|
124 |
|
125 |
def build(self, exp_dir: gr.Textbox):
|
app/train.py
CHANGED
@@ -162,7 +162,7 @@ class TrainTab:
|
|
162 |
gr.Markdown("# Training")
|
163 |
gr.Markdown(
|
164 |
"You can start training the model by clicking the button below. "
|
165 |
-
"Each time you click the button, the model will train for
|
166 |
"Tha latest *training checkpoint* will be avaible below."
|
167 |
)
|
168 |
|
@@ -178,10 +178,6 @@ class TrainTab:
|
|
178 |
fn=train_model,
|
179 |
inputs=[exp_dir],
|
180 |
outputs=[self.latest_checkpoint],
|
181 |
-
).success(
|
182 |
-
fn=train_model,
|
183 |
-
inputs=[exp_dir],
|
184 |
-
outputs=[self.latest_checkpoint],
|
185 |
)
|
186 |
|
187 |
self.train_index_btn.click(
|
|
|
162 |
gr.Markdown("# Training")
|
163 |
gr.Markdown(
|
164 |
"You can start training the model by clicking the button below. "
|
165 |
+
"Each time you click the button, the model will train for 10 epochs, which takes about 3 minutes on ZeroGPU (A100). "
|
166 |
"Tha latest *training checkpoint* will be avaible below."
|
167 |
)
|
168 |
|
|
|
178 |
fn=train_model,
|
179 |
inputs=[exp_dir],
|
180 |
outputs=[self.latest_checkpoint],
|
|
|
|
|
|
|
|
|
181 |
)
|
182 |
|
183 |
self.train_index_btn.click(
|