mirror of
https://github.com/SillyTavern/SillyTavern-Extras.git
synced 2026-05-01 03:41:24 +00:00
Move scipy import closer
This commit is contained in:
@@ -10,7 +10,6 @@ import unicodedata
|
|||||||
import torch
|
import torch
|
||||||
import time
|
import time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.io import wavfile
|
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@@ -263,6 +262,7 @@ def generate_image(input: str, steps: int = 30, scale: int = 6) -> Image:
|
|||||||
|
|
||||||
|
|
||||||
def generate_audio(text: str, voice: str):
|
def generate_audio(text: str, voice: str):
|
||||||
|
from scipy.io import wavfile
|
||||||
audio = tts_model.tts(text=text, speaker_wav=f'tts_voices/{voice}.wav', language='en')
|
audio = tts_model.tts(text=text, speaker_wav=f'tts_voices/{voice}.wav', language='en')
|
||||||
filename = f'tts_output/{voice}_{time.time_ns()}.wav';
|
filename = f'tts_output/{voice}_{time.time_ns()}.wav';
|
||||||
wavfile.write(filename, sample_rate, np.array(audio))
|
wavfile.write(filename, sample_rate, np.array(audio))
|
||||||
|
|||||||
Reference in New Issue
Block a user