This commit is contained in:
YuriHead 2023-07-05 23:28:56 +08:00
parent 245ce55708
commit 2f8c63b875
2 changed files with 6 additions and 9 deletions

View File

@ -1,10 +1,10 @@
import asyncio
import random
import sys
import edge_tts
from edge_tts import VoicesManager
import sys
from langdetect import detect
from langdetect import DetectorFactory
from langdetect import DetectorFactory, detect
DetectorFactory.seed = 0
@ -20,7 +20,7 @@ print(f"Text: {TEXT}, Language: {LANG}, Gender: {GENDER}, Rate: {RATE}, Volume:
async def _main() -> None:
voices = await VoicesManager.create()
if not GENDER is None:
if GENDER is not None:
# From "zh-cn" to "zh-CN" etc.
if LANG == "zh-cn" or LANG == "zh-tw":
LOCALE = LANG[:-2] + LANG[-2:].upper()

View File

@ -5,23 +5,20 @@ import re
import subprocess
import time
import traceback
from itertools import chain
from pathlib import Path
# os.system("wget -P cvec/ https://huggingface.co/spaces/innnky/nanami/resolve/main/checkpoint_best_legacy_500.pt")
import gradio as gr
import gradio.processing_utils as gr_pu
import librosa
import numpy as np
import soundfile
import torch
from scipy.io import wavfile
from compress_model import removeOptimizer
from edgetts.tts_voices import SUPPORTED_LANGUAGES
from inference.infer_tool import Svc
from utils import mix_model
from edgetts.tts_voices import SUPPORTED_LANGUAGES
logging.getLogger('numba').setLevel(logging.WARNING)
logging.getLogger('markdown_it').setLevel(logging.WARNING)
@ -228,7 +225,7 @@ def vc_fn2(_text, _lang, _gender, _rate, _volume, sid, output_format, vc_transfo
os.remove("tts.wav")
return "Success", output_file_path
except Exception as e:
if debug: traceback.print_exc()
if debug: traceback.print_exc() # noqa: E701
raise gr.Error(e)
def model_compression(_model):