mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-14 17:13:25 +00:00
fix: chat chroma chat and add opencc convert to asr
This commit is contained in:
@ -16,12 +16,18 @@ import tempfile
|
||||
|
||||
import json
|
||||
import os
|
||||
import opencc
|
||||
|
||||
|
||||
from ..configuration import SenseVoiceConf
|
||||
|
||||
from ..log.logging_time import logging_time
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
converter = opencc.OpenCC('s2t.json')
|
||||
|
||||
|
||||
@singleton
|
||||
class ASR(Blackbox):
|
||||
mode: str
|
||||
@ -98,17 +104,20 @@ class ASR(Blackbox):
|
||||
os.remove(temp_audio_path)
|
||||
if len(results) == 0:
|
||||
return None
|
||||
results = converter.convert(results)
|
||||
return results
|
||||
|
||||
elif user_model_name == 'funasr' or ['funasr']:
|
||||
|
||||
results = converter.convert(results)
|
||||
return results
|
||||
|
||||
else:
|
||||
results = self.paraformer([BytesIO(data)])
|
||||
if len(results) == 0:
|
||||
return None
|
||||
return results[0]
|
||||
results = converter.convert(results[0])
|
||||
return results
|
||||
|
||||
def valid(self, data: any) -> bool:
|
||||
if isinstance(data, bytes):
|
||||
|
||||
Reference in New Issue
Block a user