first commit

This commit is contained in:
2024-07-02 13:54:57 +08:00
commit 04a83926d7
112 changed files with 13631 additions and 0 deletions
@@ -0,0 +1,34 @@
from gradio_client import Client
import wave
import os
# client = Client("http://127.0.0.1:7860/")
def create_sound(text,models,speed,url):
client = Client(f"{url}")
result = client.predict(
text,
models,
"简体中文",
speed,
fn_index=0
)
print(result)
# 获取当前目录
current_dir = os.getcwd()
# print("=================================")
# print(current_dir)
# second_dir = os.chdir("./login/static/sounds/")
# current_dir = os.getcwd()
my_file_dir = f"{current_dir}/{models}"
print(my_file_dir)
if not os.path.exists(f"{current_dir}/{models}"):
os.mkdir(my_file_dir)
# 构建目标文件路径
target_file_path = os.path.join(my_file_dir, 'audio.wav')
print(target_file_path)
# 复制文件到当前目录
with open(result[1], 'rb') as source_file:
with open(target_file_path, 'wb') as target_file:
target_file.write(source_file.read())
return 1
# if __name__ == '__main__':
# create_sounds("123","example",0.81)