Last active
June 16, 2020 08:09
-
-
Save brianc118/ba36518546c8038b9d8aca4ece451681 to your computer and use it in GitHub Desktop.
Thesis - Onsets and Frames Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "Thesis - Onsets and Frames Demo", | |
"provenance": [], | |
"private_outputs": true, | |
"collapsed_sections": [], | |
"authorship_tag": "ABX9TyNLDILHScgHeNn10Vj3c9+u", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"accelerator": "GPU" | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/brianc118/ba36518546c8038b9d8aca4ece451681/thesis-onsets-and-frames-demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "r0LRoQ-8HiWb", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"# Demo for my thesis\n", | |
"\n", | |
"Steps to run demo:\n", | |
"1. Change the runtime of this Colab instances to GPU by going Runtime --> Change runtime type --> GPU.\n", | |
"2. Create a free [ngrok](https://ngrok.com/) account.\n", | |
"3. Login and copy your [authtoken](https://dashboard.ngrok.com/auth/your-authtoken).\n", | |
"4. Paste your authtoken from the previous step into the second code cell, replacing the string \\<AUTHTOKEN\\>.\n", | |
"5. Run all cells by clicking Runtime --> Run all.\n", | |
"6. In the `curl` output, you will find the links to the ngrok tunnel. Click on any of them to go to the website!" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "OEttbj6Jwo9K", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"!pip install gdown==3.6.0\n", | |
"!rm -rf onsets-and-frames\n", | |
"!git clone https://github.com/brianc118/onsets-and-frames.git\n", | |
"!chmod +x onsets-and-frames/data/*.sh\n", | |
"!mkdir -p onsets-and-frames/models\n", | |
"# Fetch pretrained model files from Google Drive.\n", | |
"!gdown https://drive.google.com/uc?id=16E1_tfKIdyHXkvjdLJGARp0RPC8z5o2N\n", | |
"!gdown https://drive.google.com/uc?id=1Bwp0BZKCIAPUdyG6yRQBkN9zONQqyfP1\n", | |
"!gdown https://drive.google.com/uc?id=1ga-rJP1mXOGpd609IDW6IHdkZyx4xSoC\n", | |
"!cp *.pt onsets-and-frames/models" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "Iwt6LqefCNr7", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip -O ngrok-stable-linux-amd64.zip\n", | |
"!unzip -u ngrok-stable-linux-amd64.zip\n", | |
"!chmod +x ngrok\n", | |
"!./ngrok authtoken <AUTHTOKEN>" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "04i6NZs6CLhG", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"!apt-get install ffmpeg\n", | |
"!apt-get install libsox-fmt-all libsox-dev sox\n", | |
"!pip install -r onsets-and-frames/requirements.txt" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "r6PkHdgWWTem", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"get_ipython().system_raw('./ngrok http 8081 &')\n", | |
"# Go to this url\n", | |
"!curl localhost:4040/api/tunnels" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "FWaiy3ltU3k4", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"!cd onsets-and-frames && python demo.py --port=8081" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To open this in Google Colab, click on "Open in Colab" at the top of the preview.