hivecorp commited on
Commit
34ebd65
·
verified ·
1 Parent(s): 8437f06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -29,7 +29,7 @@ async def text_to_speech(text, voice, rate, pitch):
29
  # Generate SRT file based on user preferences
30
  def generate_srt(words, audio_duration, srt_path, words_per_line, lines_per_paragraph):
31
  with open(srt_path, 'w', encoding='utf-8') as srt_file:
32
- segment_duration = audio_duration / (len(words) // (words_per_line * lines_per_paragraph)) # Average duration for each segment
33
  current_time = 0
34
 
35
  for i in range(0, len(words), words_per_line * lines_per_paragraph): # Every segment according to specified preferences
@@ -100,7 +100,7 @@ async def create_demo():
100
  rate_slider = gr.Slider(minimum=-50, maximum=50, value=0, label="Rate Adjustment (%)", step=1)
101
  pitch_slider = gr.Slider(minimum=-20, maximum=20, value=0, label="Pitch Adjustment (Hz)", step=1)
102
 
103
- words_per_line = gr.Slider(minimum=8, maximum=10, value=8, label="Words per Line", step=1)
104
  lines_per_paragraph = gr.Slider(minimum=1, maximum=4, value=2, label="Lines per Paragraph", step=1)
105
 
106
  generate_button = gr.Button("Generate Audio and Subtitles", variant="primary")
 
29
  # Generate SRT file based on user preferences
30
  def generate_srt(words, audio_duration, srt_path, words_per_line, lines_per_paragraph):
31
  with open(srt_path, 'w', encoding='utf-8') as srt_file:
32
+ segment_duration = audio_duration / (len(words) // lines_per_paragraph) # Average duration for each segment
33
  current_time = 0
34
 
35
  for i in range(0, len(words), words_per_line * lines_per_paragraph): # Every segment according to specified preferences
 
100
  rate_slider = gr.Slider(minimum=-50, maximum=50, value=0, label="Rate Adjustment (%)", step=1)
101
  pitch_slider = gr.Slider(minimum=-20, maximum=20, value=0, label="Pitch Adjustment (Hz)", step=1)
102
 
103
+ words_per_line = gr.Slider(minimum=8, maximum=12, value=10, label="Words per Line", step=1)
104
  lines_per_paragraph = gr.Slider(minimum=1, maximum=4, value=2, label="Lines per Paragraph", step=1)
105
 
106
  generate_button = gr.Button("Generate Audio and Subtitles", variant="primary")