Gregniuki commited on
Commit
0f4e6bf
·
1 Parent(s): b42885e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -154,6 +154,13 @@ async def main(
154
  # Rename the audio file based on the text input
155
  renamed_audio_file = os.path.join(temp_dir, f"{text_input}.mp3")
156
  os.rename(temp_audio_file, renamed_audio_file)
 
 
 
 
 
 
 
157
 
158
  # temp_audio_file = tempfile.NamedTemporaryFile(delete=False, suffix=".mp3")
159
  # audio.export(temp_audio_file.name, format="mp3")
@@ -211,7 +218,10 @@ async def main(
211
 
212
 
213
  # Save the audio as a temporary WAV file
214
- return templates.TemplateResponse("interface.html", {"request": request, "audio_file": renamed_audio_file, "data": data})
 
 
 
215
 
216
 
217
  # return {"message": f"Text to synthesize: {text_input}, Speed: {speed_slider}, Play: {play}"}
 
154
  # Rename the audio file based on the text input
155
  renamed_audio_file = os.path.join(temp_dir, f"{text_input}.mp3")
156
  os.rename(temp_audio_file, renamed_audio_file)
157
+ # Specify the path to your MP3 audio file
158
+ # audio_file_path = "path/to/your/audio.mp3"
159
+
160
+ # Check if the file exists
161
+ # if not os.path.exists(audio_file_path):
162
+ # return {"detail": "Audio file not found"}
163
+
164
 
165
  # temp_audio_file = tempfile.NamedTemporaryFile(delete=False, suffix=".mp3")
166
  # audio.export(temp_audio_file.name, format="mp3")
 
218
 
219
 
220
  # Save the audio as a temporary WAV file
221
+ # return templates.TemplateResponse("interface.html", {"request": request, "audio_file": renamed_audio_file, "data": data})
222
+
223
+ # Serve the audio file with the correct media type
224
+ return FileResponse(renamed_audio_file)
225
 
226
 
227
  # return {"message": f"Text to synthesize: {text_input}, Speed: {speed_slider}, Play: {play}"}