upload model and demo

This commit is contained in:
启焚
2025-12-15 10:51:35 +08:00
parent b9f117d7e3
commit 06b3b288df
5 changed files with 938 additions and 17 deletions

32
demo1.py Normal file
View File

@ -0,0 +1,32 @@
from funasr import AutoModel
def main():
model_dir = "FunAudioLLM/fun-asr-nano"
model = AutoModel(
model=model_dir,
trust_remote_code=True,
remote_code="./model.py",
device="cuda:0",
)
wav_path = f"{model.model_path}/example/zh.mp3"
res = model.generate(input=[wav_path], cache={}, batch_size=1)
text = res[0]["text"]
print(text)
model = AutoModel(
model=model_dir,
trust_remote_code=True,
vad_model="fsmn-vad",
vad_kwargs={"max_single_segment_time": 30000},
remote_code="./model.py",
device="cuda:0",
)
res = model.generate(input=[wav_path], cache={}, batch_size=1)
text = res[0]["text"]
print(text)
if __name__ == "__main__":
main()