Spaces:
Running
Running
csukuangfj
commited on
Commit
•
4845816
1
Parent(s):
a0ef383
fix logging
Browse files
app.py
CHANGED
@@ -19,16 +19,23 @@
|
|
19 |
# References:
|
20 |
# https://gradio.app/docs/#dropdown
|
21 |
|
22 |
-
import logging
|
23 |
import os
|
24 |
import time
|
25 |
import uuid
|
|
|
26 |
|
27 |
import gradio as gr
|
28 |
import soundfile as sf
|
29 |
|
30 |
from model import get_pretrained_model, language_to_models
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
title = "# Next-gen Kaldi: Text-to-speech (TTS)"
|
33 |
|
34 |
description = """
|
@@ -113,7 +120,7 @@ def build_html_output(s: str, style: str = "result_item_success"):
|
|
113 |
|
114 |
|
115 |
def process(language: str, repo_id: str, text: str, sid: str, speed: float):
|
116 |
-
|
117 |
sid = int(sid)
|
118 |
tts = get_pretrained_model(repo_id, speed)
|
119 |
|
@@ -137,8 +144,8 @@ def process(language: str, repo_id: str, text: str, sid: str, speed: float):
|
|
137 |
RTF: {elapsed_seconds:.3f}/{duration:.3f} = {rtf:.3f} <br/>
|
138 |
"""
|
139 |
|
140 |
-
|
141 |
-
|
142 |
|
143 |
filename = str(uuid.uuid4())
|
144 |
filename = f"{filename}.wav"
|
@@ -257,6 +264,4 @@ if __name__ == "__main__":
|
|
257 |
download_espeak_ng_data()
|
258 |
formatter = "%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s"
|
259 |
|
260 |
-
logging.basicConfig(format=formatter, level=logging.INFO)
|
261 |
-
|
262 |
demo.launch()
|
|
|
19 |
# References:
|
20 |
# https://gradio.app/docs/#dropdown
|
21 |
|
|
|
22 |
import os
|
23 |
import time
|
24 |
import uuid
|
25 |
+
from datetime import datetime
|
26 |
|
27 |
import gradio as gr
|
28 |
import soundfile as sf
|
29 |
|
30 |
from model import get_pretrained_model, language_to_models
|
31 |
|
32 |
+
|
33 |
+
def MyPrint(s):
|
34 |
+
now = datetime.now()
|
35 |
+
date_time = now.strftime("%Y-%m-%d %H:%M:%S.%f")
|
36 |
+
print(f"{date_time}: {s}")
|
37 |
+
|
38 |
+
|
39 |
title = "# Next-gen Kaldi: Text-to-speech (TTS)"
|
40 |
|
41 |
description = """
|
|
|
120 |
|
121 |
|
122 |
def process(language: str, repo_id: str, text: str, sid: str, speed: float):
|
123 |
+
MyPrint(f"Input text: {text}. sid: {sid}, speed: {speed}")
|
124 |
sid = int(sid)
|
125 |
tts = get_pretrained_model(repo_id, speed)
|
126 |
|
|
|
144 |
RTF: {elapsed_seconds:.3f}/{duration:.3f} = {rtf:.3f} <br/>
|
145 |
"""
|
146 |
|
147 |
+
MyPrint(info)
|
148 |
+
MyPrint(f"\nrepo_id: {repo_id}\ntext: {text}\nsid: {sid}\nspeed: {speed}")
|
149 |
|
150 |
filename = str(uuid.uuid4())
|
151 |
filename = f"{filename}.wav"
|
|
|
264 |
download_espeak_ng_data()
|
265 |
formatter = "%(asctime)s %(levelname)s [%(filename)s:%(lineno)d] %(message)s"
|
266 |
|
|
|
|
|
267 |
demo.launch()
|