From b48251922fe347b3eb3768f633699fb8927ae71b Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期四, 21 十二月 2023 21:26:47 +0800
Subject: [PATCH] funasr1.0

---
 funasr/download/download_from_hub.py |    2 ++
 README_zh.md                         |    8 +++++---
 funasr/__init__.py                   |    2 ++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/README_zh.md b/README_zh.md
index e4b3658..4fbf96c 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -81,11 +81,13 @@
 
 ### 闈炲疄鏃惰闊宠瘑鍒�
 ```python
-from funasr import infer
+from funasr import AutoModel
 
-p = infer(model="paraformer-zh", vad_model="fsmn-vad", punc_model="ct-punc", model_hub="ms")
+model = AutoModel(model="paraformer-zh")
+# for the long duration wav, you could add vad model
+# model = AutoModel(model="paraformer-zh", vad_model="fsmn-vad")
 
-res = p("asr_example_zh.wav", batch_size_token=5000)
+res = model(input="asr_example_zh.wav", batch_size=5000)
 print(res)
 ```
 娉細`model_hub`锛氳〃绀烘ā鍨嬩粨搴擄紝`ms`涓洪�夋嫨modelscope涓嬭浇锛宍hf`涓洪�夋嫨huggingface涓嬭浇銆�
diff --git a/funasr/__init__.py b/funasr/__init__.py
index c7cc3b6..d7736e9 100644
--- a/funasr/__init__.py
+++ b/funasr/__init__.py
@@ -29,3 +29,5 @@
     return results
 
 import_submodules(__name__)
+
+from funasr.bin.inference import AutoModel
\ No newline at end of file
diff --git a/funasr/download/download_from_hub.py b/funasr/download/download_from_hub.py
index 47eda9e..2e7578f 100644
--- a/funasr/download/download_from_hub.py
+++ b/funasr/download/download_from_hub.py
@@ -12,6 +12,8 @@
 
 def download_fr_ms(**kwargs):
 	model_or_path = kwargs.get("model")
+	if model_or_path in name_maps_ms:
+		model_or_path = name_maps_ms[model_or_path]
 	model_revision = kwargs.get("model_revision")
 	if not os.path.exists(model_or_path):
 		model_or_path = get_or_download_model_dir(model_or_path, model_revision, is_training=kwargs.get("is_training"))

--
Gitblit v1.9.1