mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-13 16:53:24 +00:00
fix: asr
This commit is contained in:
@ -85,8 +85,7 @@ class ASR(Blackbox):
|
|||||||
print(f"asr_model_name: {user_model_name}")
|
print(f"asr_model_name: {user_model_name}")
|
||||||
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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user