Gregniuki commited on
Commit
611fffa
·
1 Parent(s): 9398fdf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -25,7 +25,7 @@ from fastapi.staticfiles import StaticFiles
25
 
26
  import logging
27
 
28
-
29
 
30
  app = FastAPI()
31
  app.mount("/static", StaticFiles(directory="static"), name="static")
@@ -139,8 +139,8 @@ async def main(
139
  lang = speaker
140
  onnx_models = detect_onnx_models(models_path)
141
 
142
- if len(text_input) == 0:
143
- text_input = "1, 2, 3. This is a test. Enter some text to generate."
144
  # speaker_selection = widgets.Dropdown(
145
  # options=[],
146
  # description=f'{lan.translate(lang, "Select speaker")}:',
@@ -187,12 +187,13 @@ async def main(
187
  # temp_audio_file = os.path.join(temp_dir, "generated_audio.mp3")
188
 
189
  # Check if text_input is more than 200 characters
190
- if len(text_input) > 100:
191
  # Truncate text_input to 200 characters
192
- text_input = text_input[:100]
193
 
194
  # Rename the audio file based on the text input
195
- renamed_audio_file = os.path.join(temp_dir, f"{text_input}.mp3")
 
196
  audio.export(renamed_audio_file, format="mp3")
197
  # Save the generated audio as a temporary file
198
  filepath = renamed_audio_file
 
25
 
26
  import logging
27
 
28
+ text_input = "1, 2, 3, 4, 5 this is an audio test."
29
 
30
  app = FastAPI()
31
  app.mount("/static", StaticFiles(directory="static"), name="static")
 
139
  lang = speaker
140
  onnx_models = detect_onnx_models(models_path)
141
 
142
+ # if len(text_input) == 0:
143
+ # text_input = "1, 2, 3. This is a test. Enter some text to generate."
144
  # speaker_selection = widgets.Dropdown(
145
  # options=[],
146
  # description=f'{lan.translate(lang, "Select speaker")}:',
 
187
  # temp_audio_file = os.path.join(temp_dir, "generated_audio.mp3")
188
 
189
  # Check if text_input is more than 200 characters
190
+ # if len(text_input) > 100:
191
  # Truncate text_input to 200 characters
192
+ # text_input = text_input[:100]
193
 
194
  # Rename the audio file based on the text input
195
+ # renamed_audio_file = os.path.join(temp_dir, f"{text_input}.mp3")
196
+ renamed_audio_file = temp_dir
197
  audio.export(renamed_audio_file, format="mp3")
198
  # Save the generated audio as a temporary file
199
  filepath = renamed_audio_file