helloWorld199 commited on
Commit
dddfb2b
1 Parent(s): 5620f6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -6
app.py CHANGED
@@ -75,10 +75,16 @@ def analyze(path):
75
  #Measure time for inference
76
  end = time.time()
77
  elapsed_time = end-start
 
 
 
 
 
 
78
 
79
  bass_path, drums_path, other_path, vocals_path = None, None, None, None
80
- for root, dirs, files in os.walk(base_dir):
81
- for file_name in files:
82
  file_path = os.path.join(root, file_name)
83
  print(file_path)
84
  if "bass.wav" in file_path:
@@ -117,10 +123,14 @@ with gr.Blocks() as demo:
117
  #)
118
  elapsed_time = gr.Textbox(label='Overall inference time', scale=1)
119
  with gr.Column():
120
- bass_path = gr.Textbox(label='bass_path', scale=1)
121
- drums_path = gr.Textbox(label='drums_path', scale=1)
122
- other_path = gr.Textbox(label='other_path', scale=1)
123
- vocals_path = gr.Textbox(label='vocals_path', scale=1)
 
 
 
 
124
  #gr.Examples(
125
  # examples=[
126
  # './assets/NewJeans - Super Shy.mp3',
 
75
  #Measure time for inference
76
  end = time.time()
77
  elapsed_time = end-start
78
+
79
+ # Get the base name of the file
80
+ file_name = os.path.basename(path)
81
+
82
+ # Remove the extension from the file name
83
+ file_name_without_extension = os.path.splitext(file_name)[0]
84
 
85
  bass_path, drums_path, other_path, vocals_path = None, None, None, None
86
+ for root, dirs, files in os.walk(f"./demix/htdemucs/{file_name_without_extension}/"):
87
+ for file in files:
88
  file_path = os.path.join(root, file_name)
89
  print(file_path)
90
  if "bass.wav" in file_path:
 
123
  #)
124
  elapsed_time = gr.Textbox(label='Overall inference time', scale=1)
125
  with gr.Column():
126
+ bass = gr.Audio(label='bass', show_share_button=False)
127
+ vocals =gr.Audio(label='vocals', show_share_button=False)
128
+ other = gr.Audio(label='other', show_share_button=False)
129
+ drums =gr.Audio(label='drums', show_share_button=False)
130
+ #bass_path = gr.Textbox(label='bass_path', scale=1)
131
+ #drums_path = gr.Textbox(label='drums_path', scale=1)
132
+ #other_path = gr.Textbox(label='other_path', scale=1)
133
+ #vocals_path = gr.Textbox(label='vocals_path', scale=1)
134
  #gr.Examples(
135
  # examples=[
136
  # './assets/NewJeans - Super Shy.mp3',