add pip examples to collab

This commit is contained in:
adamnsandle
2024-07-09 10:20:50 +00:00
parent dfdc9a484e
commit d9a6941852

View File

@@ -43,10 +43,20 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"USE_PIP = True # download model using pip package or torch.hub\n",
"USE_ONNX = False # change this to True if you want to test onnx model\n", "USE_ONNX = False # change this to True if you want to test onnx model\n",
"if USE_ONNX:\n", "if USE_ONNX:\n",
" !pip install -q onnxruntime\n", " !pip install -q onnxruntime\n",
"\n", "if USE_PIP:\n",
" !pip install -q silero-vad\n",
" from silero_vad import (load_silero_vad,\n",
" read_audio,\n",
" get_speech_timestamps,\n",
" save_audio,\n",
" VADIterator,\n",
" collect_chunks)\n",
" model = load_silero_vad(onnx=USE_ONNX)\n",
"else:\n",
" model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad',\n", " model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad',\n",
" model='silero_vad',\n", " model='silero_vad',\n",
" force_reload=True,\n", " force_reload=True,\n",