šµ Moodify - Discover Songs Based on Your Image šØš¶
Moodify is a web application that generates a vibe or mood based on an uploaded image and suggests songs matching the vibe. It uses advanced AI (OpenAI and Azure Computer Vision APIs) and Spotify integration to provide an interactive and unique user experience.
š Table of Contents
š Overview
Moodify is a fun and interactive platform where users can upload images to:
- Analyze the contents of the image using Azure Computer Vision.
- Generate a "vibe" using OpenAI GPT.
- Suggest songs matching the vibe using Spotify.
The goal is to create a personalized musical experience based on the emotional or visual tone of the uploaded image.
⨠Features
- Image Analysis: Extracts descriptions of images using Azure Computer Vision.
- Vibe Generation: Generates a vibe or mood (e.g., "Calm and Relaxing") using OpenAI GPT.
- Song Recommendations: Suggests 4-5 songs matching the vibe using Spotify.
- Spotify Integration: Allows users to open songs directly in Spotify.
- Modern Design: A stylish, interactive, and professional frontend.
š Technologies Used
Backend:
- Flask: Backend framework for API development.
- Azure Computer Vision API: For image analysis and description generation.
- OpenAI GPT API: For vibe generation.
- Spotipy: Spotify API library for Python.
Frontend:
- Next.js: React-based framework for building modern web apps.
- Tailwind CSS: For styling and responsive design.
- Axios: For HTTP requests.
āļø Prerequisites
Before you begin, ensure you have the following installed:
- Python: Version 3.9 or higher.
- Node.js: Version 16.x or higher.
- npm or yarn: For managing frontend dependencies.
Additionally, you need API keys and credentials:
- Azure Computer Vision API Key and Endpoint.
- OpenAI API Key.
- Spotify API Client ID, Client Secret, and Redirect URI.
š Setup Instructions
Backend Setup
- Clone the Repository:
git clone https://github.com/your-username/moodify.git
cd moodify/backend
- Create and Activate Virtual Environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install Dependencies:
pip install -r requirements.txt
- Set Environment Variables: Create a .env file in the backend directory and add:
OPENAI_API_KEY=your_openai_api_key
AZURE_CV_API_KEY=your_azure_computer_vision_api_key
AZURE_CV_ENDPOINT=your_azure_computer_vision_endpoint
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
SPOTIFY_REDIRECT_URI=http://127.0.0.1:5001/callback
- Run the Flask Server:
flask run --host=0.0.0.0 --port=5001
Frontend Setup
- Navigate to the Frontend Directory:
cd ../frontend
- Install dependencies:
npm install
- Set Environment Variables: Create a .env.local file in the frontend directory and add:
NEXT_PUBLIC_BACKEND_URL=http://127.0.0.1:5001
- Run the Development Server:
npm run dev
- Open your browser and go to http://localhost:3000
š§ How It Works
- Image Upload:Users upload an image via the frontend.
- Image Analysis: The backend analyzes the image using Azure Computer Vision API.
- Vibe Generation: OpenAI GPT generates a vibe based on the image description.
- Song Suggestions: The backend searches for songs on Spotify matching the vibe and returns them to the frontend.
š File Structure
moodify/
ā
āāā backend/
ā āāā app.py # Flask app entry point
ā āāā routes/ # Flask API routes
ā āāā services/ # Logic for Azure, OpenAI, and Spotify
ā āāā .env # Backend environment variables
ā āāā requirements.txt # Python dependencies
ā
āāā frontend/
ā āāā public/ # Static assets
ā āāā src/
ā ā āāā app/ # Next.js app components
ā ā āāā components/ # Reusable React components
ā ā āāā styles/ # Tailwind CSS styles
ā āāā .env.local # Frontend environment variables
ā āāā package.json # Frontend dependencies
ā
āāā README.md # Project documentation
š® Usage
- Navigate to the frontend site (http://localhost:3000).
- Upload an image.
- View the vibe and suggested songs.
- Click "Listen on Spotify" to play the songs.
š¤ Contributing
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add a new feature"
- Push to the branch:
git push origin feature-name
- Open a pull request.
š Acknowledgements
- Azure Computer Vision for image analysis.
- OpenAI GPT for vibe generation.
- Spotify API for song suggestions.
- Tailwind CSS for beautiful styling.
Enjoy Moodify! š