CRIMJOBBERS commited on
Commit
605bb3d
·
verified ·
1 Parent(s): 36e6b11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -108,10 +108,8 @@ def tts_via_api(text):
108
  response = requests.post(url, headers=headers, json=payload)
109
 
110
  if response.status_code == 200:
111
- output_path = "output.mp3"
112
- with open(output_path, "wb") as f:
113
- f.write(response.content)
114
- return output_path
115
  else:
116
  print("TTS API Error:", response.status_code, response.text)
117
  return None
 
108
  response = requests.post(url, headers=headers, json=payload)
109
 
110
  if response.status_code == 200:
111
+ audio_bytes = BytesIO(response.content)
112
+ return (audio_bytes, "audio/mp3")
 
 
113
  else:
114
  print("TTS API Error:", response.status_code, response.text)
115
  return None