feat: openvoice重构,添加语音克隆功能

This commit is contained in:
killua committed 2024-05-22 17:26:29 +08:00
1 parent 8369090313
commit 5cf16bf03b
6 files changed
+99 -32

No files matched your search

+5 -5
View File
@@ -5,7 +5,7 @@ import os
class UserServiceTest:
def __init__(self,socket="http://127.0.0.1:8001"):
def __init__(self,socket="http://127.0.0.1:7878"):
self.socket = socket
def test_user_create(self):
@@ -132,7 +132,7 @@ class UserServiceTest:
current_file_path = os.path.abspath(__file__)
current_dir = os.path.dirname(current_file_path)
tests_dir = os.path.dirname(current_dir)
wav_file_path = os.path.join(tests_dir, 'assets', 'iat_mp3_8k.mp3')
wav_file_path = os.path.join(tests_dir, 'assets', 'demo_speaker0.mp3')
with open(wav_file_path, 'rb') as audio_file:
files = {'audio_file':(wav_file_path,audio_file,'audio/mpeg')}
response = requests.post(url, files=files)
@@ -141,15 +141,15 @@ class UserServiceTest:
print("音频上传测试成功")
else:
raise Exception("音频上传测试失败")
def test_update_audio(self):
url = f"{self.socket}/users/audio/{self.audio_id}"
current_file_path = os.path.abspath(__file__)
current_dir = os.path.dirname(current_file_path)
tests_dir = os.path.dirname(current_dir)
wav_file_path = os.path.join(tests_dir, 'assets', 'iat_mp3_8k.mp3')
wav_file_path = os.path.join(tests_dir, 'assets', 'demo_speaker0.mp3')
with open(wav_file_path, 'rb') as audio_file:
files = {'audio_file':(wav_file_path,audio_file,'audio/mpeg')}
files = {'audio_file':(wav_file_path,audio_file,'audio/wav')}
response = requests.put(url, files=files)
if response.status_code == 200:
print("音频上传测试成功")