From 1df10311c4e6df252db748293fd47792abae6a61 Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期一, 25 三月 2024 10:16:51 +0800
Subject: [PATCH] install requirements automatically

---
 funasr/download/download_from_hub.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/funasr/download/download_from_hub.py b/funasr/download/download_from_hub.py
index ef2832f..f23be0d 100644
--- a/funasr/download/download_from_hub.py
+++ b/funasr/download/download_from_hub.py
@@ -72,6 +72,9 @@
             kwargs["jieba_usr_dict"] = os.path.join(model_or_path, "jieba_usr_dict")
     if isinstance(kwargs, DictConfig):
         kwargs = OmegaConf.to_container(kwargs, resolve=True)
+    if os.path.exists(os.path.join(model_or_path, "requirements.txt")):
+        from funasr.utils.install_model_requirements import install_requirements
+        install_requirements(os.path.join(model_or_path, "requirements.txt"))
     return kwargs
 
 def add_file_root_path(model_or_path: str, file_path_metas: dict, cfg = {}):

--
Gitblit v1.9.1