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

View File

@ -85,8 +85,7 @@ class ASR(Blackbox):
print(f"asr_model_name: {user_model_name}")
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:
temp_audio_file.write(data)
temp_audio_path = temp_audio_file.name
@ -130,7 +129,7 @@ class ASR(Blackbox):
if isinstance(setting, str):
try:
setting = json.loads(setting) # 尝试将字符串转换为字典
setting = json.loads(setting) #str covert to dict
except json.JSONDecodeError:
return JSONResponse(content={"error": "Invalid settings format"}, status_code=status.HTTP_400_BAD_REQUEST)