owiedotch commited on
Commit
c07b48c
1 Parent(s): ff92e4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -124,9 +124,12 @@ def decode_audio(encoded_file_path):
124
  with torch.no_grad():
125
  waveform = semanticodec.decode(tokens)
126
 
 
 
 
127
  # Save to a temporary WAV file
128
  temp_wav_path = tempfile.mktemp(suffix=".wav")
129
- torchaudio.save(temp_wav_path, waveform.squeeze(0).cpu(), sample_rate)
130
  return temp_wav_path
131
 
132
  except Exception as e:
 
124
  with torch.no_grad():
125
  waveform = semanticodec.decode(tokens)
126
 
127
+ # Move waveform to CPU for saving
128
+ waveform_cpu = waveform.cpu()
129
+
130
  # Save to a temporary WAV file
131
  temp_wav_path = tempfile.mktemp(suffix=".wav")
132
+ torchaudio.save(temp_wav_path, waveform_cpu.squeeze(0), sample_rate)
133
  return temp_wav_path
134
 
135
  except Exception as e: