JacobLinCool commited on
Commit
24caa86
1 Parent(s): 6db8e8a

feat: show download button on audio

Browse files
Files changed (1) hide show
  1. app/infer.py +15 -11
app/infer.py CHANGED
@@ -59,7 +59,7 @@ def infer(
59
  def merge(exp_dir: str, original_audio: str, vocal: Tuple[int, np.ndarray]) -> str:
60
  base = os.path.basename(original_audio)
61
  base = os.path.splitext(base)[0]
62
- music = os.path.join("separated", "htdemucs", base, "no-vocals.wav")
63
 
64
  tmp = os.path.join(exp_dir, "tmp.wav")
65
  sf.write(tmp, vocal[1], vocal[0])
@@ -83,12 +83,12 @@ class InferenceTab:
83
  )
84
 
85
  with gr.Row():
86
- with gr.Column():
87
- self.original_audio = gr.Audio(
88
- label="Upload original audio",
89
- type="filepath",
90
- show_download_button=True,
91
- )
92
  with gr.Column():
93
  self.f0add = gr.Slider(
94
  label="F0 add",
@@ -111,12 +111,16 @@ class InferenceTab:
111
  step=0.01,
112
  value=0.33,
113
  )
114
- with gr.Column():
115
- self.infer_btn = gr.Button(value="Infer", variant="primary")
116
  with gr.Row():
117
- self.infer_output = gr.Audio(label="Inferred audio")
 
 
118
  with gr.Row():
119
- self.merge_output = gr.Audio(label="Merged audio")
 
 
120
 
121
  def build(self, exp_dir: gr.Textbox):
122
  self.infer_btn.click(
 
59
  def merge(exp_dir: str, original_audio: str, vocal: Tuple[int, np.ndarray]) -> str:
60
  base = os.path.basename(original_audio)
61
  base = os.path.splitext(base)[0]
62
+ music = os.path.join("separated", "htdemucs", base, "no_vocals.wav")
63
 
64
  tmp = os.path.join(exp_dir, "tmp.wav")
65
  sf.write(tmp, vocal[1], vocal[0])
 
83
  )
84
 
85
  with gr.Row():
86
+ self.original_audio = gr.Audio(
87
+ label="Upload original audio",
88
+ type="filepath",
89
+ show_download_button=True,
90
+ )
91
+
92
  with gr.Column():
93
  self.f0add = gr.Slider(
94
  label="F0 add",
 
111
  step=0.01,
112
  value=0.33,
113
  )
114
+
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):
126
  self.infer_btn.click(