FFomy commited on
Commit
473ab62
·
verified ·
1 Parent(s): 9c07b4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -5,18 +5,16 @@ REPO_TYPE = "hf"
5
  if REPO_TYPE not in ["hf", "ms"]:
6
  raise ValueError("REPO_TYPE must be either 'hf' for Hugging Face or 'ms' for ModelScope.")
7
 
8
-
9
- from huggingface_hub import snapshot_download
 
 
10
 
11
 
12
 
13
  # 1. 定义本地路径和远程仓库ID
14
  FUN_ASR_NANO_LOCAL_PATH = "./Fun-ASR/model"
15
- FUN_ASR_NANO_REPO_ID = "FunAudioLLM/Fun-ASR-Nano-2512"
16
  SENSE_VOICE_SMALL_LOCAL_PATH = "./Fun-ASR/model/SenseVoiceSmall"
17
- # SENSE_VOICE_SMALL_REPO_ID = "FunAudioLLM/SenseVoiceSmall"
18
- # REPO_TYPE = "hf" # "hf" for Hugging Face, "ms" for ModelScope
19
- SENSE_VOICE_SMALL_REPO_ID = "iic/SenseVoiceSmall"
20
 
21
 
22
  if REPO_TYPE == "ms":
@@ -408,7 +406,7 @@ def get_model_options(pipeline_type):
408
  # Dictionary to store loaded models
409
  loaded_models = {}
410
 
411
- @spaces.GPU(duration=120)
412
  def transcribe_audio(audio_input, audio_url, proxy_url, proxy_username, proxy_password, pipeline_type, model_id, download_method, start_time=None, end_time=None, verbose=False):
413
  """
414
  Transcribes audio from a given source using SenseVoice.
 
5
  if REPO_TYPE not in ["hf", "ms"]:
6
  raise ValueError("REPO_TYPE must be either 'hf' for Hugging Face or 'ms' for ModelScope.")
7
 
8
+ if REPO_TYPE == "hf":
9
+ from huggingface_hub import snapshot_download
10
+ else:
11
+ from modelscope.hub.snapshot_download import snapshot_download
12
 
13
 
14
 
15
  # 1. 定义本地路径和远程仓库ID
16
  FUN_ASR_NANO_LOCAL_PATH = "./Fun-ASR/model"
 
17
  SENSE_VOICE_SMALL_LOCAL_PATH = "./Fun-ASR/model/SenseVoiceSmall"
 
 
 
18
 
19
 
20
  if REPO_TYPE == "ms":
 
406
  # Dictionary to store loaded models
407
  loaded_models = {}
408
 
409
+ @spaces.GPU()
410
  def transcribe_audio(audio_input, audio_url, proxy_url, proxy_username, proxy_password, pipeline_type, model_id, download_method, start_time=None, end_time=None, verbose=False):
411
  """
412
  Transcribes audio from a given source using SenseVoice.