Mahiruoshi commited on
Commit
66db8e9
1 Parent(s): 0839393

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -133,7 +133,7 @@ def infer(text ,language, speaker_id,n_scale= 0.667,n_scale_w = 0.8, l_scale = 1
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,9 +151,10 @@ def infer(text ,language, speaker_id,n_scale= 0.667,n_scale_w = 0.8, l_scale = 1
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")
 
133
  audio_fin = []
134
  c = 0
135
  t = datetime.timedelta(seconds=0)
136
+ f1 = open("subtitles.srt",'w',encoding='utf-8')
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
+ f1.write(str(c-1)+'\n'+time_start+' --> '+time_end+'\n'+sentence+'\n\n')
155
  audio_fin.append(audio)
156
+ file_path = "subtitles.srt"
157
+ return (hps_ms.data.sampling_rate, np.concatenate(audio_fin)),file_path
158
  lan = ["中文","日文","自动"]
159
  idols = ["高咲侑","歩夢","かすみ","しずく","果林","愛","せつ菜","璃奈","栞子","エマ","ランジュ","ミア","派蒙"]
160
  hps_ms = utils.get_hparams_from_file("lovelive/config.json")