Zw07 commited on
Commit
7248e7e
·
verified ·
1 Parent(s): 092917a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -142,15 +142,15 @@ def main():
142
  st.markdown(wav)
143
  #wav= wav.unsqueeze(0)
144
 
145
- #2nd way
146
- # Convert the tensor to a byte-like object in WAV format
147
- with io.BytesIO() as buffer:
148
- # Save the audio to the buffer using torchaudio
149
- torchaudio.save(buffer, wav, default_sr, format="wav")
150
- # Get the byte data from the buffer
151
- wav = buffer.getvalue()
152
- # Play the audio file (WAV format)
153
- st.audio(wav, format="audio/wav")
154
 
155
  # wav, sample_rate = torchaudio.load(audio_file, format="mp3/wav")
156
  st.markdown("SR")
 
142
  st.markdown(wav)
143
  #wav= wav.unsqueeze(0)
144
 
145
+ # #2nd way
146
+ # # Convert the tensor to a byte-like object in WAV format
147
+ # with io.BytesIO() as buffer:
148
+ # # Save the audio to the buffer using torchaudio
149
+ # torchaudio.save(buffer, wav, default_sr, format="wav")
150
+ # # Get the byte data from the buffer
151
+ # wav = buffer.getvalue()
152
+ # # Play the audio file (WAV format)
153
+ # st.audio(wav, format="audio/wav")
154
 
155
  # wav, sample_rate = torchaudio.load(audio_file, format="mp3/wav")
156
  st.markdown("SR")