upload model and demo
This commit is contained in:
32
demo1.py
Normal file
32
demo1.py
Normal 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()
|
||||
Reference in New Issue
Block a user