Pecorized commited on
Commit
c9897c5
1 Parent(s): eee15fe

label once more

Browse files
Files changed (1) hide show
  1. app.py +3 -10
app.py CHANGED
@@ -70,9 +70,6 @@ import torch
70
  from audio_separator import Separator
71
 
72
  def inference(audio, vocals, bass, drums, other, piano, guitar, lead_vocals, backing_vocals):
73
- status_message = "Processing..."
74
-
75
-
76
  os.makedirs("out", exist_ok=True)
77
  audio_path = 'test.wav'
78
  write(audio_path, audio[0], audio[1])
@@ -85,14 +82,14 @@ def inference(audio, vocals, bass, drums, other, piano, guitar, lead_vocals, bac
85
  print("Demucs script output:", process.stdout.decode())
86
  except subprocess.CalledProcessError as e:
87
  print("Error in Demucs script:", e.stderr.decode())
88
- return [gr.Audio(visible=False)] * 8 + [loading_gif_path]
89
 
90
  try:
91
  separator = Separator("./out/htdemucs_6s/test/vocals.wav", model_name='UVR_MDXNET_KARA_2', use_cuda=device=='cuda', output_format='wav')
92
  primary_stem_path, secondary_stem_path = separator.separate()
93
  except Exception as e:
94
  print("Error in custom separation:", str(e))
95
- return [gr.Audio(visible=False)] * 8 + [loading_gif_path]
96
 
97
  stem_paths = {
98
  "vocals": "./out/htdemucs_6s/test/vocals.wav" if vocals else None,
@@ -105,9 +102,7 @@ def inference(audio, vocals, bass, drums, other, piano, guitar, lead_vocals, bac
105
  "backing_vocals": secondary_stem_path if backing_vocals else None
106
  }
107
 
108
- # Once processing is done, hide the GIF by returning a transparent image
109
-
110
- return [gr.Audio(stem_paths[stem], visible=bool(stem_paths[stem])) for stem in stem_paths], "Done! Successfully processed."
111
 
112
  # Define checkboxes for each stem
113
  checkbox_labels = ["Full Vocals", "Bass", "Drums", "Other", "Piano", "Guitar", "Lead Vocals", "Backing Vocals"]
@@ -125,5 +120,3 @@ iface = gr.Interface(
125
  )
126
 
127
  iface.launch()
128
-
129
-
 
70
  from audio_separator import Separator
71
 
72
  def inference(audio, vocals, bass, drums, other, piano, guitar, lead_vocals, backing_vocals):
 
 
 
73
  os.makedirs("out", exist_ok=True)
74
  audio_path = 'test.wav'
75
  write(audio_path, audio[0], audio[1])
 
82
  print("Demucs script output:", process.stdout.decode())
83
  except subprocess.CalledProcessError as e:
84
  print("Error in Demucs script:", e.stderr.decode())
85
+ return [gr.Audio(visible=False)] * 8 + ["Failed to process audio."]
86
 
87
  try:
88
  separator = Separator("./out/htdemucs_6s/test/vocals.wav", model_name='UVR_MDXNET_KARA_2', use_cuda=device=='cuda', output_format='wav')
89
  primary_stem_path, secondary_stem_path = separator.separate()
90
  except Exception as e:
91
  print("Error in custom separation:", str(e))
92
+ return [gr.Audio(visible=False)] * 8 + ["Failed to process audio."]
93
 
94
  stem_paths = {
95
  "vocals": "./out/htdemucs_6s/test/vocals.wav" if vocals else None,
 
102
  "backing_vocals": secondary_stem_path if backing_vocals else None
103
  }
104
 
105
+ return tuple([gr.Audio(stem_paths[stem], visible=bool(stem_paths[stem])) for stem in stem_paths]) + ("Done! Successfully processed.",)
 
 
106
 
107
  # Define checkboxes for each stem
108
  checkbox_labels = ["Full Vocals", "Bass", "Drums", "Other", "Piano", "Guitar", "Lead Vocals", "Backing Vocals"]
 
120
  )
121
 
122
  iface.launch()