TaiYouWeb commited on
Commit
6b12cc3
·
verified ·
1 Parent(s): 4634abc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -7,18 +7,16 @@ import TTS.api
7
  import TTS.utils.manage as manage
8
  import torch
9
  from pydub import AudioSegment
10
- import gradio as gr # Gradio库
11
 
12
  import config
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
 
@@ -35,7 +33,7 @@ def synthesize_tts(
35
  language: str = 'ja',
36
  temperature: float = 0.65,
37
  length_penalty: float = 1.0,
38
- repetition_penalty: int = 2.0,
39
  top_k: int = 50,
40
  top_p: float = 0.8,
41
  speed: float = 1.0,
@@ -100,8 +98,6 @@ def synthesize_tts(
100
  if isinstance(temp_file, str) and os.path.exists(temp_file):
101
  os.remove(temp_file)
102
 
103
-
104
- # 创建Gradio界面
105
  inputs = [
106
  gr.Textbox(value="Hello, World!", label="Text to Synthesize"),
107
  gr.File(file_types=["audio"], label="Speaker WAV files (optional)", file_count="multiple"),
@@ -124,7 +120,7 @@ inputs = [
124
  gr.Textbox(value="en", label="Language"),
125
  gr.Slider(0, 1, value=0.65, step=0.01, label="Temperature"),
126
  gr.Slider(0.5, 2, value=1.0, step=0.1, label="Length Penalty"),
127
- gr.Slider(1.0, 10.0, value=2.0, step=0.1, label="Repetition Penalty"),
128
  gr.Slider(1, 100, value=50, step=1, label="Top-K"),
129
  gr.Slider(0, 1, value=0.8, step=0.01, label="Top-P"),
130
  gr.Slider(0.5, 2, value=1.0, step=0.01, label="Speed"),
 
7
  import TTS.utils.manage as manage
8
  import torch
9
  from pydub import AudioSegment
10
+ import gradio as gr
11
 
12
  import config
13
 
14
  device = "cuda" if torch.cuda.is_available() else "cpu"
15
 
 
16
  def ask_tos_patch(self, output_path):
17
  print("Automatically accepting the terms of service.")
18
  return True
19
 
 
20
  manage.ModelManager.ask_tos = ask_tos_patch
21
  tts = TTS.api.TTS()
22
 
 
33
  language: str = 'ja',
34
  temperature: float = 0.65,
35
  length_penalty: float = 1.0,
36
+ repetition_penalty: float = 1.9,
37
  top_k: int = 50,
38
  top_p: float = 0.8,
39
  speed: float = 1.0,
 
98
  if isinstance(temp_file, str) and os.path.exists(temp_file):
99
  os.remove(temp_file)
100
 
 
 
101
  inputs = [
102
  gr.Textbox(value="Hello, World!", label="Text to Synthesize"),
103
  gr.File(file_types=["audio"], label="Speaker WAV files (optional)", file_count="multiple"),
 
120
  gr.Textbox(value="en", label="Language"),
121
  gr.Slider(0, 1, value=0.65, step=0.01, label="Temperature"),
122
  gr.Slider(0.5, 2, value=1.0, step=0.1, label="Length Penalty"),
123
+ gr.Slider(1.0, 10.0, value=1.9, step=0.1, label="Repetition Penalty"),
124
  gr.Slider(1, 100, value=50, step=1, label="Top-K"),
125
  gr.Slider(0, 1, value=0.8, step=0.01, label="Top-P"),
126
  gr.Slider(0.5, 2, value=1.0, step=0.01, label="Speed"),