youngtsai commited on
Commit
96e8ee6
·
1 Parent(s): ffcc440

# Define the path for the audio file in the /mnt/data/ directory

Browse files

audio_path = "/mnt/data/generated_audio_openai.mp3"

# Save the audio stream to a file in the /mnt/data/ directory
with open(audio_path, "wb") as audio_file:
audio_file.write(response.data)

Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -271,11 +271,12 @@ def paragraph_save_and_tts(paragraph_text):
271
  input=paragraph_text,
272
  )
273
 
274
- # Define the path for the audio file
275
- audio_path = "generated_audio_openai.mp3"
276
 
277
- # Save the audio stream to a file
278
- response.stream_to_file(audio_path)
 
279
 
280
  # Return the path to the audio file along with the text
281
  return paragraph_text, audio_path
 
271
  input=paragraph_text,
272
  )
273
 
274
+ # Define the path for the audio file in the /mnt/data/ directory
275
+ audio_path = "/mnt/data/generated_audio_openai.mp3"
276
 
277
+ # Save the audio stream to a file in the /mnt/data/ directory
278
+ with open(audio_path, "wb") as audio_file:
279
+ audio_file.write(response.data)
280
 
281
  # Return the path to the audio file along with the text
282
  return paragraph_text, audio_path