TaiYouWeb commited on
Commit
aa93b1b
·
verified ·
1 Parent(s): fe2ff93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -4,6 +4,7 @@ import tempfile
4
  from typing import List
5
 
6
  import TTS.api
 
7
  import torch
8
  from pydub import AudioSegment
9
  import gradio as gr # Gradio库
@@ -12,8 +13,18 @@ import config
12
 
13
  device = "cuda" if torch.cuda.is_available() else "cpu"
14
 
 
 
 
 
 
 
 
 
 
15
  models = {}
16
  for id, model in config.models.items():
 
17
  models[id] = TTS.api.TTS(model).to(device)
18
 
19
 
 
4
  from typing import List
5
 
6
  import TTS.api
7
+ import TTS.utils.manage as manage
8
  import torch
9
  from pydub import AudioSegment
10
  import gradio as gr # Gradio库
 
13
 
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
 
16
+ # 定义一个函数来自动接受许可条款
17
+ def ask_tos_patch(self, output_path):
18
+ print("Automatically accepting the terms of service.")
19
+ return True
20
+
21
+ # 使用我们定义的函数替换原有的 ask_tos 方法
22
+ manage.ModelManager.ask_tos = ask_tos_patch
23
+ tts = TTS.api.TTS()
24
+
25
  models = {}
26
  for id, model in config.models.items():
27
+ tts.download_model_by_name(model)
28
  models[id] = TTS.api.TTS(model).to(device)
29
 
30