Type in any text, and spotif.ai analyzes your phrase and creates a Spotify playlist for you based on your phrase.
Built for nwHacks 2022 - Honorary Mention (6th place)!!
This is the repo for the backend code of spotif.ai. View the frontend code here!
- Django/Django REST Framework
- Tensorflow
- FastAPI
- Jupyter Notebook and Google Colab
- Spotify Web API
Clone this repository.
In the root of this repository, create a virtual Python environment with python3 -m venv venv
.
Activate your virtual environment by running source venv/bin/activate
.
If you're on windows you'll have to run source venv/Scripts/activate
.
Run pip install -r requirements.txt
Create a .env
file. See .env_template
for details on which environment variables you need.
Note: Since loading Tensorflow models is GPU-intensive, we set up an ngrok server in a Google Colab using FastAPI. See the colab
folder. The URL generated by running this file is what is used for the environment variable COLAB_SERVER_URL
.
Run python manage.py migrate
.
Activate the server with python manage.py runserver
.
spotif.ai provides the following endpoints
POST /create
{
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
},
"body": {
"token": "auth-token",
"phrase": "prompt",
"limit": 50
}
}
POST /playlist
{
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
},
"body": {
"token": "auth-token",
"playlist_name": "name",
"playlist_description": "Auto-generated by Spotif.ai",
"songs": "comma-separated list of song uris",
}
}