SpotifAI is an interactive web application that generates playlists using OpenAI and Spotify API integration.
Ensure you have the following installed:
- Python (3.x recommended)
- Virtual Environment (
venv) - Flask and other dependencies (listed below)
- Navigate to your desired project directory:
cd path/to/project - Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- Windows:
venv\Scripts\activate
- Mac/Linux:
source venv/bin/activate
- Windows:
- Install Flask:
pip install flask
- Run the Flask server to verify installation:
python ml.py
- Open your browser and go to http://127.0.0.1:5000/ to check if the server is running.
Ensure the virtual environment is activated, then install the required dependencies:
pip install flask openai spotipy python-dotenv requests logging-
Spotify API Setup:
- Create a Spotify Developer Account
- Navigate to Dashboard → Your App → Settings
- Copy your
Client IDandClient Secret - Set up a redirect URI as
http://localhost:5000/callback
-
AI API Setup:
- Sign up at AIML API
- Generate an API key from API Settings
- Add the keys to your
.envfile:SPOTIPY_CLIENT_ID=your_spotify_client_id SPOTIPY_CLIENT_SECRET=your_spotify_client_secret AI_BASE_URL=https://api.aimlapi.com AI_API_KEY=YOUR_API_KEY
Follow this directory structure while working on the project:
SPOTIFAI/
│-- venv/
│-- static/ # Frontend assets (CSS, JS, images)
│-- templates/ # HTML templates
│-- ml.py # Main Flask backend
│-- .env # Environment variables
│-- requirements.txt # List of dependencies
│-- README.md # Project documentation
- Ensure the virtual environment is activated.
- Run the application:
python ml.py
- Copy the URL displayed in the terminal (
http://127.0.0.1:5000/). - Open the URL in your browser and start using SPOTIFAI!
- Always activate the virtual environment before running the app.
- If you install new dependencies, update
requirements.txtusing:pip freeze > requirements.txt
Enjoy your playlist creation experience with SPOTIFAI! 🎵✨
Contributors: