Skip to content

Streaming services automatically scan audio for copyrighted content, and mutes or blocks uploads featuring this content. This makes it difficult for content creators to find appropriate background music. Our app automatically generates royalty-free music for content creators saving them time and money.

License

Notifications You must be signed in to change notification settings

anika-sw/ag_backend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutomatedGroove Backend

Streaming services automatically scan audio for copyrighted content, and mute or block uploads featuring this content. This makes it difficult for content creators to find appropriate background music. Our app, AutomatedGroove, automatically generates royalty-free music for content creators, saving them time and money.

Find the frontend repository here: AutomatedGroove Frontend

Table of Contents

Installation

  1. Clone the repository to your local machine:
    git clone https://github.com/anika-sw/ag_backend.git
  2. Navigate into the repository:
    cd ag_backend
  3. Create a virtual environment:
    python -m venv venv
  4. Activate the virtual environment:
    source venv/bin/activate     # On Windows use `venv\Scripts\activate`
  5. Install dependencies:
    pip install -r requirements.txt

Configuration

Set the following environment variables in a .env file:

  • OPENAI_API_KEY
  • MUSICFY_API_KEY

Note: You need to obtain your own API keys from both OpenAI and Musicfy AI to use in this project.

Implementation

  1. Run the flask development server:
    $ flask run
  2. To access the application locally, open a web browser and go to http://localhost:5000.

API Documentation

Endpoint: /create_song_name

  • Method: POST

  • Description: Generates a song name based on the provided genre, mood, and tempo.

Request Body The request body should be a JSON object containing the following fields:

{
  "genre": ["pop"],
  "mood": ["happy"],
  "tempo": ["medium"]
}

Response Body The response will be a JSON object containing a generated song name.

"Song Name”

Endpoint: /create_song

  • Method: POST

  • Description: Generates a song based on the provided genre, mood, and tempo by calling the Musicfy API.

Request Body The request body should be a JSON object containing the following fields:

{
  "genre": ["pop"],
  "mood": ["happy"],
  "tempo": ["medium"]
}

Response Body The response will be a JSON object containing the generated song url from the Musicfy API.

[
  {
    "file_url": "https://example-url",
    "type": "music"
  }
]

Endpoint: /verify-recaptcha

  • Method: POST

  • Description: Passes a token to Google's reCAPTCHA server to verify a user's reCAPTCHA response.

Request Body The request body should be a JSON object containing the following fields:

{
	"secret": os.getenv("RECAPTCHA_SECRET_KEY"),
	"response": token,
}

Response Body The response will be a JSON object containing the generated song url from the reCAPTCHA API.

{
  "success": true|false,
  "challenge_ts": timestamp,  // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ)
  "hostname": string,         // the hostname of the site where the reCAPTCHA was solved
  "error-codes": [...]        // optional
}

Testing

Run the pytest testing framework:

$ pytest

Project Structure

ag_backend/
├── __pycache__/       # Auto-populated bytcode files
├── .pytest_cache/     # Auto-populated pytest cache
├── app/                
│   ├── __pycache__/   # Auto-populated bytcode files
│   ├── __init__.py    # Directory marker
│   └── routes.py      # API routes and helper functions                  
├── tests/  
│   ├── __pycache__/   # Auto-populated bytcode files
│   ├── __init__.py    # Directory marker
│   ├── _test.py       # Test file
│   └── conftest.py    # Test configuration
├── venv/              # Virtual environment files        
├── .env               # Secret environment variables
├── .gitignore         # Files and directories to ignore in Git
├── LICENSE                     
├── package-lock.json  # Auto-populated during production deployment
├── README.md          # Project documentation
└── requirements.txt	 # Project dependencies

License

This project is licensed under the MIT License. See the LICENSE file for details.

Creators

About

Streaming services automatically scan audio for copyrighted content, and mutes or blocks uploads featuring this content. This makes it difficult for content creators to find appropriate background music. Our app automatically generates royalty-free music for content creators saving them time and money.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%