Mahiruoshi commited on
Commit
0839393
1 Parent(s): c300a0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -13,6 +13,7 @@ from text import text_to_sequence
13
  import gradio as gr
14
  import time
15
  import datetime
 
16
  def get_text(text, hps):
17
  text_norm = text_to_sequence(text, symbols, hps.data.text_cleaners)
18
  if hps.data.add_blank:
@@ -132,7 +133,7 @@ def infer(text ,language, speaker_id,n_scale= 0.667,n_scale_w = 0.8, l_scale = 1
132
  audio_fin = []
133
  c = 0
134
  t = datetime.timedelta(seconds=0)
135
- f1 = open("subtitles.srt",'w',encoding='utf-8')
136
  for sentence in final_list:
137
  c +=1
138
  stn_tst = get_text(sle(language,sentence), hps_ms)
@@ -150,11 +151,9 @@ def infer(text ,language, speaker_id,n_scale= 0.667,n_scale_w = 0.8, l_scale = 1
150
  t+=last_time
151
  time_end = str(t).split(".")[0] + "," + str(t.microseconds)[:3]
152
  print(time_end)
153
- f1.write(str(c-1)+'\n'+time_start+' --> '+time_end+'\n'+sentence+'\n\n')
154
  audio_fin.append(audio)
155
- with open("subtitles.srt", 'r', encoding='utf-8') as file:
156
- subtitles = file.read()
157
- return (hps_ms.data.sampling_rate, np.concatenate(audio_fin)),subtitles
158
  lan = ["中文","日文","自动"]
159
  idols = ["高咲侑","歩夢","かすみ","しずく","果林","愛","せつ菜","璃奈","栞子","エマ","ランジュ","ミア","派蒙"]
160
  hps_ms = utils.get_hparams_from_file("lovelive/config.json")
 
13
  import gradio as gr
14
  import time
15
  import datetime
16
+ import os
17
  def get_text(text, hps):
18
  text_norm = text_to_sequence(text, symbols, hps.data.text_cleaners)
19
  if hps.data.add_blank:
 
133
  audio_fin = []
134
  c = 0
135
  t = datetime.timedelta(seconds=0)
136
+ content = []
137
  for sentence in final_list:
138
  c +=1
139
  stn_tst = get_text(sle(language,sentence), hps_ms)
 
151
  t+=last_time
152
  time_end = str(t).split(".")[0] + "," + str(t.microseconds)[:3]
153
  print(time_end)
154
+ content.append(str(c-1)+'\n'+time_start+' --> '+time_end+'\n'+sentence+'\n\n')
155
  audio_fin.append(audio)
156
+ return (hps_ms.data.sampling_rate, np.concatenate(audio_fin)),content
 
 
157
  lan = ["中文","日文","自动"]
158
  idols = ["高咲侑","歩夢","かすみ","しずく","果林","愛","せつ菜","璃奈","栞子","エマ","ランジュ","ミア","派蒙"]
159
  hps_ms = utils.get_hparams_from_file("lovelive/config.json")