Spaces:
Running
Running
ArnavGhost
commited on
Update server.py
Browse files
server.py
CHANGED
@@ -10,17 +10,13 @@ os.makedirs('uploaded', exist_ok=True)
|
|
10 |
os.makedirs('processed', exist_ok=True)
|
11 |
|
12 |
app = FastAPI()
|
|
|
|
|
13 |
|
14 |
# Mount the static files directory
|
15 |
app.mount("/processed", StaticFiles(directory="processed"), name="processed")
|
16 |
|
17 |
def process_audio(audio_file_path, text):
|
18 |
-
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
19 |
-
|
20 |
-
model = build_audiosep(
|
21 |
-
config_yaml='config/audiosep_base.yaml',
|
22 |
-
checkpoint_path='checkpoint/audiosep_base_4M_steps.ckpt',
|
23 |
-
device=device)
|
24 |
|
25 |
output_file = os.path.join('processed', 'SeparatedAudio.wav')
|
26 |
separate_audio(model, audio_file_path, text, output_file, device)
|
|
|
10 |
os.makedirs('processed', exist_ok=True)
|
11 |
|
12 |
app = FastAPI()
|
13 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
14 |
+
model = build_audiosep(config_yaml='config/audiosep_base.yaml',checkpoint_path='checkpoint/audiosep_base_4M_steps.ckpt',device=device)
|
15 |
|
16 |
# Mount the static files directory
|
17 |
app.mount("/processed", StaticFiles(directory="processed"), name="processed")
|
18 |
|
19 |
def process_audio(audio_file_path, text):
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
output_file = os.path.join('processed', 'SeparatedAudio.wav')
|
22 |
separate_audio(model, audio_file_path, text, output_file, device)
|