jhtonyKoo commited on
Commit
ae8d74e
·
verified ·
1 Parent(s): 49cfd0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -58,14 +58,21 @@ def inference(file_uploaded_in, file_uploaded_ref):
58
  # clear out previously separated results
59
  os.system(f"rm -r {yt_video_dir}/separated")
60
  # change file path name
61
- os.system(f"cp {file_uploaded_in} {yt_video_dir}/input.wav")
62
- os.system(f"cp {file_uploaded_ref} {yt_video_dir}/reference.wav")
 
 
 
 
 
 
63
 
64
  # Perform music mixing style transfer
65
  args = set_up()
66
 
67
  inference_style_transfer = Mixing_Style_Transfer_Inference(args)
68
- output_wav_path, fin_data_out_mix = inference_style_transfer.inference(file_uploaded_in, file_uploaded_ref)
 
69
 
70
  return (44100, fin_data_out_mix)
71
 
@@ -101,7 +108,7 @@ with gr.Blocks() as demo:
101
  with gr.Column():
102
  with gr.Blocks():
103
  with gr.Tab("Input Music"):
104
- file_uploaded_in = gr.Audio(label="Input track (mix) to be mixing style transferred", type='filepath')
105
  with gr.Tab("YouTube url"):
106
  with gr.Row():
107
  yt_link_in = gr.Textbox(
@@ -126,7 +133,7 @@ with gr.Blocks() as demo:
126
  )
127
  with gr.Blocks():
128
  with gr.Tab("Reference Music"):
129
- file_uploaded_ref = gr.Audio(label="Reference track (mix) to copy mixing style", type='filepath')
130
  with gr.Tab("YouTube url"):
131
  with gr.Row():
132
  yt_link_ref = gr.Textbox(
 
58
  # clear out previously separated results
59
  os.system(f"rm -r {yt_video_dir}/separated")
60
  # change file path name
61
+ # os.system(f"cp {file_uploaded_in} {yt_video_dir}/input.wav")
62
+ # os.system(f"cp {file_uploaded_ref} {yt_video_dir}/reference.wav")
63
+
64
+ sample_rate, data = file_uploaded_in
65
+ sf.write(f"{yt_video_dir}/input.wav", data, sample_rate)
66
+ sample_rate, data = file_uploaded_ref
67
+ sf.write(f"{yt_video_dir}/reference.wav", data, sample_rate)
68
+
69
 
70
  # Perform music mixing style transfer
71
  args = set_up()
72
 
73
  inference_style_transfer = Mixing_Style_Transfer_Inference(args)
74
+ # output_wav_path, fin_data_out_mix = inference_style_transfer.inference(file_uploaded_in, file_uploaded_ref)
75
+ output_wav_path, fin_data_out_mix = inference_style_transfer.inference(f"{yt_video_dir}/input.wav", f"{yt_video_dir}/reference.wav")
76
 
77
  return (44100, fin_data_out_mix)
78
 
 
108
  with gr.Column():
109
  with gr.Blocks():
110
  with gr.Tab("Input Music"):
111
+ file_uploaded_in = gr.Audio(label="Input track (mix) to be mixing style transferred")
112
  with gr.Tab("YouTube url"):
113
  with gr.Row():
114
  yt_link_in = gr.Textbox(
 
133
  )
134
  with gr.Blocks():
135
  with gr.Tab("Reference Music"):
136
+ file_uploaded_ref = gr.Audio(label="Reference track (mix) to copy mixing style")
137
  with gr.Tab("YouTube url"):
138
  with gr.Row():
139
  yt_link_ref = gr.Textbox(