devilent2 commited on
Commit
c67e757
1 Parent(s): 82370e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -25,6 +25,9 @@ def load_pipeline(model_name):
25
  )
26
 
27
  pipe = load_pipeline(DEFAULT_MODEL_NAME)
 
 
 
28
  #pipe = None
29
 
30
 
@@ -97,9 +100,16 @@ def transcribe(audio_path, model_name):
97
  global pipe
98
  if model_name != pipe.model.name_or_path:
99
  print("old model is:"+ pipe.model.name_or_path )
100
- print(str(time.time())+' start load model ' + model_name)
101
- pipe = load_pipeline(model_name)
102
- print(str(time.time())+' finished load model ' + model_name)
 
 
 
 
 
 
 
103
 
104
  start_time = time.time() # Record the start time
105
  print(str(time.time())+' start processing and set recording start time point')
 
25
  )
26
 
27
  pipe = load_pipeline(DEFAULT_MODEL_NAME)
28
+ openai_pipe=load_pipeline("openai/whisper-large-v3")
29
+ default_pipe = load_pipeline(DEFAULT_MODEL_NAME)
30
+
31
  #pipe = None
32
 
33
 
 
100
  global pipe
101
  if model_name != pipe.model.name_or_path:
102
  print("old model is:"+ pipe.model.name_or_path )
103
+ if model_name=="openai/whisper-large-v3":
104
+ pipe=openai_pipe
105
+ print(str(time.time())+" use openai model " + pipe.model.name_or_path)
106
+ elif model_name==DEFAULT_MODEL_NAME:
107
+ pipe=default_pipe
108
+ print(str(time.time())+" use default model " + pipe.model.name_or_path)
109
+ else:
110
+ print(str(time.time())+' start load model ' + model_name)
111
+ pipe = load_pipeline(model_name)
112
+ print(str(time.time())+' finished load model ' + model_name)
113
 
114
  start_time = time.time() # Record the start time
115
  print(str(time.time())+' start processing and set recording start time point')