This commit is contained in:
0Xiao0
2024-10-11 20:28:25 +08:00
parent 8783f27fdb
commit 416978f6c6

View File

@ -86,7 +86,6 @@ class ASR(Blackbox):
data = args[0] data = args[0]
if user_model_name == 'sensevoice' or ['sensevoice']: if user_model_name == 'sensevoice' or ['sensevoice']:
# 创建一个临时文件
with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as temp_audio_file: with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as temp_audio_file:
temp_audio_file.write(data) temp_audio_file.write(data)
temp_audio_path = temp_audio_file.name temp_audio_path = temp_audio_file.name
@ -130,7 +129,7 @@ class ASR(Blackbox):
if isinstance(setting, str): if isinstance(setting, str):
try: try:
setting = json.loads(setting) # 尝试将字符串转换为字典 setting = json.loads(setting) #str covert to dict
except json.JSONDecodeError: except json.JSONDecodeError:
return JSONResponse(content={"error": "Invalid settings format"}, status_code=status.HTTP_400_BAD_REQUEST) return JSONResponse(content={"error": "Invalid settings format"}, status_code=status.HTTP_400_BAD_REQUEST)