Fix reporting of error back to HTTP client
This commit is contained in:
parent
1bec818bc7
commit
9a8e34c839
3 changed files with 46 additions and 3 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
# Copyright 2022 Mycroft AI Inc.
|
# Copyright 2022 Mycroft AI Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,18 @@
|
||||||
#!/usr/bin/env python3
|
# Copyright 2022 Mycroft AI Inc.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
import argparse
|
import argparse
|
||||||
import asyncio
|
import asyncio
|
||||||
import io
|
import io
|
||||||
|
|
@ -117,7 +131,7 @@ def do_synthesis_proc(args: argparse.Namespace, request_queue: Queue):
|
||||||
_LOGGER.exception("Error during inference")
|
_LOGGER.exception("Error during inference")
|
||||||
|
|
||||||
# Signal error on main loop
|
# Signal error on main loop
|
||||||
asyncio.get_event_loop().call_soon_threadsafe(
|
item.loop.call_soon_threadsafe(
|
||||||
item.future.set_exception, e
|
item.future.set_exception, e
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,36 @@ import numpy as np
|
||||||
|
|
||||||
WILDCARD = "*"
|
WILDCARD = "*"
|
||||||
|
|
||||||
|
LANG_NAMES = {
|
||||||
|
"bn": ("বাংলা", "Bengali"),
|
||||||
|
"af_ZA": "Afrikaans",
|
||||||
|
"da_DK": ("Dansk", "Danish"),
|
||||||
|
"de_DE": ("Deutsch", "German"),
|
||||||
|
"en_UK": "English",
|
||||||
|
"en_US": "English",
|
||||||
|
"el_GR": ("Ελληνικά", "Greek"),
|
||||||
|
"es_ES": ("Español", "Spanish"),
|
||||||
|
"fa": ("فارسی", "Persian"),
|
||||||
|
"fi_FI": ("Suomi", "Finnish"),
|
||||||
|
"fr_FR": ("Français", "French"),
|
||||||
|
"gu_IN": ("ગુજરાતી", "Gujarati"),
|
||||||
|
"ha_NE": "Hausa",
|
||||||
|
"hu_HU": ("Magyar Nyelv", "Hungarian"),
|
||||||
|
"it_IT": ("Italiano", "Italian"),
|
||||||
|
"jv_ID": ("Basa Jawa", "Javanese"),
|
||||||
|
"ko_KO": ("한국어", "Korean"),
|
||||||
|
"ne_NP": ("नेपाली", "Nepali"),
|
||||||
|
"nl": ("Nederlands", "Dutch"),
|
||||||
|
"pl_PL": ("Polski", "Polish"),
|
||||||
|
"ru_RU": ("Русский", "Russian"),
|
||||||
|
"sw": "Kiswahili",
|
||||||
|
"te_IN": ("తెలుగు", "Telugu"),
|
||||||
|
"tn_ZA": "Setswana",
|
||||||
|
"uk_UK": ("украї́нська мо́ва", "Ukrainian"),
|
||||||
|
"vi_VN": ("Tiếng Việt", "Vietnamese"),
|
||||||
|
"yo": ("Èdè Yorùbá", "Yoruba"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def audio_float_to_int16(
|
def audio_float_to_int16(
|
||||||
audio: np.ndarray, max_wav_value: float = 32767.0
|
audio: np.ndarray, max_wav_value: float = 32767.0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue