Merge branch 'pr/thorstenMueller/623' into dev

This commit is contained in:
Eren Gölge 2021-01-26 12:19:39 +01:00
commit a3adcaccdb
2 changed files with 147 additions and 0 deletions

View File

@ -8,6 +8,7 @@ from pathlib import Path
from flask import Flask, render_template, request, send_file
from TTS.utils.synthesizer import Synthesizer
from TTS.utils.manage import ModelManager
from TTS.utils.io import load_config
def create_argparser():
@ -26,6 +27,7 @@ def create_argparser():
parser.add_argument('--port', type=int, default=5002, help='port to listen on.')
parser.add_argument('--use_cuda', type=convert_boolean, default=False, help='true to use CUDA.')
parser.add_argument('--debug', type=convert_boolean, default=False, help='true to enable Flask debug mode.')
parser.add_argument('--show_details', type=convert_boolean, default=False, help='Generate model detail page.')
return parser
synthesizer = None
@ -81,6 +83,20 @@ app = Flask(__name__)
def index():
return render_template('index.html')
@app.route('/details')
def details():
model_config = load_config(args.tts_config)
if args.vocoder_config is not None and os.path.isfile(args.vocoder_config):
vocoder_config = load_config(args.vocoder_config)
else:
vocoder_config = None
return render_template('details.html',
show_details=args.show_details
, model_config=model_config
, vocoder_config=vocoder_config
, args=args.__dict__
)
@app.route('/api/tts', methods=['GET'])
def tts():

View File

@ -0,0 +1,131 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>TTS engine</title>
<!-- Bootstrap core CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous"
rel="stylesheet">
<!-- Custom styles for this template -->
<style>
body {
padding-top: 54px;
}
@media (min-width: 992px) {
body {
padding-top: 56px;
}
}
</style>
</head>
<body>
<a href="https://github.com/mozilla/TTS"><img style="position: absolute; z-index:1000; top: 0; left: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png" alt="Fork me on GitHub"></a>
{% if show_details == true %}
<div class="container">
<b>Model details</b>
</div>
<div class="container">
<details>
<summary>CLI arguments:</summary>
<table border="1" align="center" width="75%">
<tr>
<td> CLI key </td>
<td> Value </td>
</tr>
{% for key, value in args.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</table>
</details>
</div></br>
<div class="container">
{% if model_config != None %}
<details>
<summary>Model config:</summary>
<table border="1" align="center" width="75%">
<tr>
<td> Key </td>
<td> Value </td>
</tr>
{% for key, value in model_config.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</table>
</details>
{% endif %}
</div></br>
<div class="container">
{% if vocoder_config != None %}
<details>
<summary>Vocoder model config:</summary>
<table border="1" align="center" width="75%">
<tr>
<td> Key </td>
<td> Value </td>
</tr>
{% for key, value in vocoder_config.items() %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</table>
</details>
{% endif %}
</div></br>
{% else %}
<div class="container">
<b>Please start server with --show_details=true to see details.</b>
</div>
{% endif %}
</body>
</html>