-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·51 lines (43 loc) · 1.5 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
main_dir=$(pwd)
env=$main_dir/venv
node_dir=$main_dir/node_modules
models_dir=$main_dir/models
# declaring the best models available for each language
english_model="vosk-model-en-us-0.22"
portuguese_model="vosk-model-pt-fb-v0.1.1-20220516_2113"
spanish_model="vosk-model-es-0.42"
# checks if main project directories exist and starts them if not
if [ ! -d "$models_dir" ]; then
mkdir $models_dir
fi
if [ ! -d "$env" ]; then
python -m venv venv
$env/bin/pip install -r requirements.txt
fi
if [ ! -d "$node_dir" ]; then
npm install
fi
cd $models_dir
# checks in $models_dir if the models directories exist, downloads and extracts them if not
if [ ! -d "$portuguese_model" ]; then
printf "\nDownloading ${portuguese_model}\n"
curl -O https://alphacephei.com/vosk/models/${portuguese_model}.zip
python $main_dir/python_scripts/extract_file.py $models_dir/${portuguese_model}.zip
fi
if [ ! -d "$spanish_model" ]; then
printf "\nDownloading ${spanish_model}\n"
curl -O https://alphacephei.com/vosk/models/${spanish_model}.zip
python $main_dir/python_scripts/extract_file.py $models_dir/${spanish_model}.zip
fi
if [ ! -d "$english_model" ]; then
printf "\nDownloading ${english_model}\n"
curl -O https://alphacephei.com/vosk/models/${english_model}.zip
python $main_dir/python_scripts/extract_file.py $models_dir/${english_model}.zip
fi
cd $main_dir
export MODELS_DIR=$models_dir
export ENGLISH_MODEL=$english_model
export PORTUGUESE_MODEL=$portuguese_model
export SPANISH_MODEL=$spanish_model
npm start