jlvdoorn commited on
Commit
db11291
1 Parent(s): 659ddf4

load local model if available else fallback to other model

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -3,8 +3,11 @@ from transformers import pipeline
3
  import gradio as gr
4
  import os
5
 
6
- #%%
7
- whisper = pipeline(model='/mnt/projects/whisper/WhisperANSP/Models/whisper-large-v2-atco2-asr-atcosim-ANSP-3h1m', task='automatic-speech-recognition')
 
 
 
8
  bert_atco_ner = pipeline(model='Jzuluaga/bert-base-ner-atc-en-atco2-1h')
9
 
10
  #%%
 
3
  import gradio as gr
4
  import os
5
 
6
+ ## Try to load a local model if available
7
+ try:
8
+ whisper = pipeline(model='/mnt/projects/whisper/WhisperANSP/Models/whisper-large-v2-atco2-asr-atcosim-ANSP-3h1m', task='automatic-speech-recognition')
9
+ except:
10
+ whisper = pipeline(model='jlvdoorn/whisper-large-v2-atco2-asr-atcosim')
11
  bert_atco_ner = pipeline(model='Jzuluaga/bert-base-ner-atc-en-atco2-1h')
12
 
13
  #%%