Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,7 @@ import pytube as pt
|
|
| 19 |
from pytube.exceptions import VideoUnavailable
|
| 20 |
|
| 21 |
from inference.style_transfer import *
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
yt_video_dir = "./yt_dir/0"
|
|
@@ -56,9 +57,6 @@ def get_audio_from_yt_video_ref(yt_link: str, start_point_in_second=0, duration_
|
|
| 56 |
return filename_ref, filename_ref
|
| 57 |
|
| 58 |
def inference(file_uploaded_in, file_uploaded_ref):
|
| 59 |
-
|
| 60 |
-
output_wav_path = None
|
| 61 |
-
|
| 62 |
# Perform music mixing style transfer
|
| 63 |
args = set_up()
|
| 64 |
|
|
@@ -67,6 +65,15 @@ def inference(file_uploaded_in, file_uploaded_ref):
|
|
| 67 |
|
| 68 |
return output_wav_path, output_wav_path
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
with gr.Blocks() as demo:
|
| 72 |
gr.HTML(
|
|
@@ -126,26 +133,40 @@ with gr.Blocks() as demo:
|
|
| 126 |
inputs=[yt_link_ref],
|
| 127 |
outputs=[yt_audio_path_ref, file_uploaded_ref],
|
| 128 |
)
|
| 129 |
-
with gr.Column():
|
| 130 |
-
inference_btn = gr.Button("Perform Style Transfer")
|
| 131 |
|
| 132 |
with gr.Group():
|
| 133 |
gr.HTML(
|
| 134 |
"""
|
| 135 |
-
<div> <h3> <center> Mixing Style
|
| 136 |
"""
|
| 137 |
)
|
| 138 |
-
with gr.
|
| 139 |
-
|
| 140 |
-
output_mix_p = gr.Audio(label="Download output mix")
|
| 141 |
with gr.Row():
|
| 142 |
-
output_mix = gr.
|
| 143 |
inference_btn.click(
|
| 144 |
inference,
|
| 145 |
inputs=[file_uploaded_in, file_uploaded_ref],
|
| 146 |
-
outputs=[
|
| 147 |
)
|
| 148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
|
| 151 |
if __name__ == "__main__":
|
|
|
|
| 19 |
from pytube.exceptions import VideoUnavailable
|
| 20 |
|
| 21 |
from inference.style_transfer import *
|
| 22 |
+
from inference.mastering_transfer import *
|
| 23 |
|
| 24 |
|
| 25 |
yt_video_dir = "./yt_dir/0"
|
|
|
|
| 57 |
return filename_ref, filename_ref
|
| 58 |
|
| 59 |
def inference(file_uploaded_in, file_uploaded_ref):
|
|
|
|
|
|
|
|
|
|
| 60 |
# Perform music mixing style transfer
|
| 61 |
args = set_up()
|
| 62 |
|
|
|
|
| 65 |
|
| 66 |
return output_wav_path, output_wav_path
|
| 67 |
|
| 68 |
+
def inference_mastering(file_uploaded_in, file_uploaded_ref):
|
| 69 |
+
# Perform music mastering style transfer
|
| 70 |
+
args = set_up()
|
| 71 |
+
|
| 72 |
+
inference_mastering_style_transfer = Mastering_Style_Transfer_Inference(args)
|
| 73 |
+
output_wav_path_mastering = inference_mastering_style_transfer.inference(file_uploaded_in, file_uploaded_ref)
|
| 74 |
+
|
| 75 |
+
return output_wav_path_mastering, output_wav_path_mastering
|
| 76 |
+
|
| 77 |
|
| 78 |
with gr.Blocks() as demo:
|
| 79 |
gr.HTML(
|
|
|
|
| 133 |
inputs=[yt_link_ref],
|
| 134 |
outputs=[yt_audio_path_ref, file_uploaded_ref],
|
| 135 |
)
|
|
|
|
|
|
|
| 136 |
|
| 137 |
with gr.Group():
|
| 138 |
gr.HTML(
|
| 139 |
"""
|
| 140 |
+
<div> <h3> <center> Mixing Style Transfer. </h3> </div>
|
| 141 |
"""
|
| 142 |
)
|
| 143 |
+
with gr.Column():
|
| 144 |
+
inference_btn = gr.Button("Perform Style Transfer")
|
|
|
|
| 145 |
with gr.Row():
|
| 146 |
+
output_mix = gr.Audio(label="mixing style transferred music track")
|
| 147 |
inference_btn.click(
|
| 148 |
inference,
|
| 149 |
inputs=[file_uploaded_in, file_uploaded_ref],
|
| 150 |
+
outputs=[output_mix],
|
| 151 |
)
|
| 152 |
|
| 153 |
+
|
| 154 |
+
with gr.Group():
|
| 155 |
+
gr.HTML(
|
| 156 |
+
"""
|
| 157 |
+
<div> <h3> <center> Mastering Style Transfer. </h3> </div>
|
| 158 |
+
"""
|
| 159 |
+
)
|
| 160 |
+
with gr.Column():
|
| 161 |
+
inference_mastering_btn = gr.Button("Perform Mastering Style Transfer")
|
| 162 |
+
with gr.Row():
|
| 163 |
+
output_master = gr.Audio(label="mastering style transferred music track")
|
| 164 |
+
inference_mastering_btn.click(
|
| 165 |
+
inference_mastering,
|
| 166 |
+
inputs=[file_uploaded_in, file_uploaded_ref],
|
| 167 |
+
outputs=[output_master],
|
| 168 |
+
)
|
| 169 |
+
|
| 170 |
|
| 171 |
|
| 172 |
if __name__ == "__main__":
|