Spaces:
Runtime error
Runtime error
Commit ·
bf186e6
1
Parent(s): 0116557
move waveform to device
Browse files
app.py
CHANGED
|
@@ -21,8 +21,9 @@ STEM_CHOICES = {
|
|
| 21 |
|
| 22 |
@spaces.GPU
|
| 23 |
def separate_stem(audio_file_path: str, model_name: str, stem_choice: str) -> AudioSignal:
|
|
|
|
| 24 |
model = pretrained.get_model(model_name)
|
| 25 |
-
model.to(
|
| 26 |
model.eval()
|
| 27 |
|
| 28 |
waveform, sr = torchaudio.load(audio_file_path)
|
|
|
|
| 21 |
|
| 22 |
@spaces.GPU
|
| 23 |
def separate_stem(audio_file_path: str, model_name: str, stem_choice: str) -> AudioSignal:
|
| 24 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 25 |
model = pretrained.get_model(model_name)
|
| 26 |
+
model.to(device)
|
| 27 |
model.eval()
|
| 28 |
|
| 29 |
waveform, sr = torchaudio.load(audio_file_path)
|