Spaces:
Runtime error
Runtime error
xj
commited on
Commit
•
b6e73ca
1
Parent(s):
a90c9d1
[feat] add log timestamp & change layout
Browse files
app.py
CHANGED
@@ -1,4 +1,16 @@
|
|
1 |
# coding=utf-8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import time
|
3 |
import os
|
4 |
import gradio as gr
|
@@ -10,10 +22,8 @@ from text import text_to_sequence
|
|
10 |
import torch
|
11 |
from torch import no_grad, LongTensor
|
12 |
import webbrowser
|
13 |
-
import logging
|
14 |
import gradio.processing_utils as gr_processing_utils
|
15 |
from gradio_client import utils as client_utils
|
16 |
-
logging.getLogger('numba').setLevel(logging.WARNING)
|
17 |
limitation = os.getenv("SYSTEM") == "spaces" # limit text and audio length in huggingface spaces
|
18 |
|
19 |
audio_postprocess_ori = gr.Audio.postprocess
|
@@ -113,7 +123,7 @@ if __name__ == '__main__':
|
|
113 |
|
114 |
with gr.Blocks() as app:
|
115 |
gr.Markdown(
|
116 |
-
"# <center> VITS
|
117 |
)
|
118 |
|
119 |
with gr.Tabs():
|
@@ -121,17 +131,18 @@ if __name__ == '__main__':
|
|
121 |
with gr.Row():
|
122 |
with gr.Column():
|
123 |
input_text = gr.Textbox(label="Text (200 words limitation) " if limitation else "Text", lines=5, value="可莉不知道喔。", elem_id=f"input-text")
|
124 |
-
lang = gr.Dropdown(label="Language", choices=["中文", "日语", "中日混合(中文用[ZH][ZH]包裹起来,日文用[JA][JA]包裹起来)"],
|
125 |
-
type="index", value="中文")
|
126 |
btn = gr.Button(value="Submit")
|
127 |
with gr.Row():
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
with gr.Row():
|
132 |
ns = gr.Slider(label="noise_scale(控制感情变化程度)", minimum=0.1, maximum=1.0, step=0.1, value=0.1, interactive=True)
|
133 |
nsw = gr.Slider(label="noise_scale_w(控制音素发音长度)", minimum=0.1, maximum=1.0, step=0.1, value=0.668, interactive=True)
|
134 |
ls = gr.Slider(label="length_scale(控制整体语速)", minimum=0.1, maximum=2.0, step=0.1, value=1.2, interactive=True)
|
|
|
|
|
|
|
135 |
with gr.Column():
|
136 |
o1 = gr.Textbox(label="Output Message")
|
137 |
o2 = gr.Audio(label="Output Audio", elem_id=f"tts-audio")
|
|
|
1 |
# coding=utf-8
|
2 |
+
import logging
|
3 |
+
import sys
|
4 |
+
logging.getLogger('numba').setLevel(logging.WARNING)
|
5 |
+
|
6 |
+
logging.basicConfig(
|
7 |
+
format="%(asctime)s | %(levelname)s | %(name)s | %(message)s",
|
8 |
+
datefmt="%Y-%m-%d %H:%M:%S",
|
9 |
+
level=os.environ.get("LOGLEVEL", "DEBUG").upper(),
|
10 |
+
stream=sys.stdout,
|
11 |
+
)
|
12 |
+
logger = logging.getLogger("APP")
|
13 |
+
|
14 |
import time
|
15 |
import os
|
16 |
import gradio as gr
|
|
|
22 |
import torch
|
23 |
from torch import no_grad, LongTensor
|
24 |
import webbrowser
|
|
|
25 |
import gradio.processing_utils as gr_processing_utils
|
26 |
from gradio_client import utils as client_utils
|
|
|
27 |
limitation = os.getenv("SYSTEM") == "spaces" # limit text and audio length in huggingface spaces
|
28 |
|
29 |
audio_postprocess_ori = gr.Audio.postprocess
|
|
|
123 |
|
124 |
with gr.Blocks() as app:
|
125 |
gr.Markdown(
|
126 |
+
"# <center> VITS语音在线合成\n"
|
127 |
)
|
128 |
|
129 |
with gr.Tabs():
|
|
|
131 |
with gr.Row():
|
132 |
with gr.Column():
|
133 |
input_text = gr.Textbox(label="Text (200 words limitation) " if limitation else "Text", lines=5, value="可莉不知道喔。", elem_id=f"input-text")
|
|
|
|
|
134 |
btn = gr.Button(value="Submit")
|
135 |
with gr.Row():
|
136 |
+
lang = gr.Dropdown(label="Language", choices=["中文", "日语", "中日混合(中文用[ZH][ZH]包裹起来,日文用[JA][JA]包裹起来)"],
|
137 |
+
type="index", value="中文")
|
138 |
+
sid = gr.Dropdown(label="Speaker", choices=speakers, type="index", value=speakers[329])
|
139 |
with gr.Row():
|
140 |
ns = gr.Slider(label="noise_scale(控制感情变化程度)", minimum=0.1, maximum=1.0, step=0.1, value=0.1, interactive=True)
|
141 |
nsw = gr.Slider(label="noise_scale_w(控制音素发音长度)", minimum=0.1, maximum=1.0, step=0.1, value=0.668, interactive=True)
|
142 |
ls = gr.Slider(label="length_scale(控制整体语速)", minimum=0.1, maximum=2.0, step=0.1, value=1.2, interactive=True)
|
143 |
+
with gr.Row():
|
144 |
+
search = gr.Textbox(label="Search Speaker", lines=1)
|
145 |
+
btn2 = gr.Button(value="Search")
|
146 |
with gr.Column():
|
147 |
o1 = gr.Textbox(label="Output Message")
|
148 |
o2 = gr.Audio(label="Output Audio", elem_id=f"tts-audio")
|