Skip to content

Instantly share code, notes, and snippets.

@regstuff
Created February 10, 2024 06:53
Show Gist options
  • Save regstuff/de017d0f5c90e2c41bde505af6a7b1ab to your computer and use it in GitHub Desktop.
Save regstuff/de017d0f5c90e2c41bde505af6a7b1ab to your computer and use it in GitHub Desktop.
Setup for a VM on Azure to use as a transcriber
#!/bin/bash
# Modify your app.py to run on port 80 if you don't want to open up ports in Azure networking. You'll need sudo (as below) to run the flask server on port 80. Consider setting up an NGINX reverse proxy instead. Remove sudo in the crontab and install entries below if not using port 80.
# You'll also have to change the reset command to work with sudo too if using port 80: echo whateverpassword | sudo -S -u whateverusername screen -S screen_to_test -X quit
sudo apt update
sudo apt install -y python3-pip git-lfs ffmpeg python3-venv
pip install flask
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
mkdir sgtranscribe
mkdir livetranscribe
cd sgtranscribe
python -m venv livetranscribe
git lfs install
git clone https://huggingface.co/guillaumekln/faster-whisper-small.en
cd ../livetranscribe
python -m venv livetranscribe
git lfs install
git clone https://huggingface.co/guillaumekln/faster-whisper-small.en
echo "Don't forget to upload your app related files to sgtranscribe and livetranscribe!"
(crontab -l 2>/dev/null; echo "* * * * * /usr/bin/screen -list | /bin/grep -q \"sgtranscribe\" || (/usr/bin/screen -dmS sgtranscribe /bin/bash -c \"cd /home/sravanth/sgtranscribe; source livetranscribe/bin/activate; sudo python app.py\")") | crontab -
(crontab -l 2>/dev/null; echo "* * * * * /usr/bin/screen -list | /bin/grep -q \"livetranscribe\" || (/usr/bin/screen -dmS livetranscribe /bin/bash -c \"cd /home/sravanth/livetranscribe; source livetranscribe/bin/activate; sudo python app.py\")") | crontab -
(crontab -l 2>/dev/null; echo "* * * * * sleep 15; /usr/bin/screen -list | /bin/grep -q \"sgtranscribe\" || (/usr/bin/screen -dmS sgtranscribe /bin/bash -c \"cd /home/sravanth/sgtranscribe; source livetranscribe/bin/activate; sudo python app.py\")") | crontab -
(crontab -l 2>/dev/null; echo "* * * * * sleep 15; /usr/bin/screen -list | /bin/grep -q \"livetranscribe\" || (/usr/bin/screen -dmS livetranscribe /bin/bash -c \"cd /home/sravanth/livetranscribe; source livetranscribe/bin/activate; sudo python app.py\")") | crontab -
(crontab -l 2>/dev/null; echo "* * * * * sleep 30; /usr/bin/screen -list | /bin/grep -q \"sgtranscribe\" || (/usr/bin/screen -dmS sgtranscribe /bin/bash -c \"cd /home/sravanth/sgtranscribe; source livetranscribe/bin/activate; sudo python app.py\")") | crontab -
(crontab -l 2>/dev/null; echo "* * * * * sleep 30; /usr/bin/screen -list | /bin/grep -q \"livetranscribe\" || (/usr/bin/screen -dmS livetranscribe /bin/bash -c \"cd /home/sravanth/livetranscribe; source livetranscribe/bin/activate; sudo python app.py\")") | crontab -
(crontab -l 2>/dev/null; echo "* * * * * sleep 45; /usr/bin/screen -list | /bin/grep -q \"sgtranscribe\" || (/usr/bin/screen -dmS sgtranscribe /bin/bash -c \"cd /home/sravanth/sgtranscribe; source livetranscribe/bin/activate; sudo python app.py\")") | crontab -
(crontab -l 2>/dev/null; echo "* * * * * sleep 45; /usr/bin/screen -list | /bin/grep -q \"livetranscribe\" || (/usr/bin/screen -dmS livetranscribe /bin/bash -c \"cd /home/sravanth/livetranscribe; source livetranscribe/bin/activate; sudo python app.py\")") | crontab -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment