SaltProphet commited on
Commit
b14dcd0
·
verified ·
1 Parent(s): f6e6833

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -36
app.py CHANGED
@@ -1,39 +1,4 @@
1
- import gradio as gr
2
- import os
3
- import shutil
4
- import asyncio
5
- import librosa
6
- import librosa.display
7
- import soundfile as sf
8
- import numpy as np
9
- import time
10
- import zipfile
11
- import tempfile
12
- import matplotlib.pyplot as plt
13
- import matplotlib
14
- matplotlib.use('Agg')
15
-
16
- def update_output_visibility(choice):
17
- if "2 Stems" in choice:
18
- return {
19
- vocals_output: gr.update(visible=True),
20
- drums_output: gr.update(visible=False),
21
- bass_output: gr.update(visible=False),
22
- other_output: gr.update(visible=True, label="Instrumental (No Vocals)")
23
- }
24
- elif "4 Stems" in choice:
25
- return {
26
- vocals_output: gr.update(visible=True),
27
- drums_output: gr.update(visible=True),
28
- bass_output: gr.update(visible=True),
29
- other_output: gr.update(visible=True, label="Other")
30
- }
31
-
32
- async def separate_stems(audio_file_path, stem_choice, progress=gr.Progress(track_tqdm=True)):
33
- if audio_file_path is None: raise gr.Error("No audio file uploaded!")
34
- progress(0, desc="Starting...")
35
- try:
36
- progress(0.05, desc="Preparing audio file...")
37
  original_filename_base = os.path.basename(audio_file_path).rsplit('.', 1)[0]
38
  stable_input_path = f"stable_input_{original_filename_base}.wav"
39
  shutil.copy(audio_file_path, stable_input_path)
 
1
+ stable_filename_base = os.path.basename(stable_input_path).rsplit('.', 1)[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  original_filename_base = os.path.basename(audio_file_path).rsplit('.', 1)[0]
3
  stable_input_path = f"stable_input_{original_filename_base}.wav"
4
  shutil.copy(audio_file_path, stable_input_path)