GithubHelp home page GithubHelp logo

ariessa / melofy-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 12.66 MB

An API in Python for generating melody from supplied audio file link.

License: MIT License

Python 100.00%
api python flask

melofy-api's Introduction

Melofy API

An API in Python for generating melody from supplied audio file link.


Prerequisites

In order to run this API, you need to install the following software first:


API Endpoints

  • /

    A route to the homepage


    Example using curl command to send GET request in Windows CMD

    curl http://melofyapi.ap.ngrok.io
    

  • /generate

    A route to generate melody from supplied audio file link


    Example using curl command to send POST request in Windows CMD

    curl -i -X POST -H "Content-Type:application/json" -d "{\"audio_file_link\": \"https://melofyapi.blob.core.windows.net/melofy-api-input/twinkle_twinkle_little_star.wav\" }" http://melofyapi.ap.ngrok.io/generate
    

Deploy


Deploy Flask app locally


  1. Clone GitHub repository
git clone https://github.com/ariessa/melofy-api.git
  1. Create new conda environment named snakes that contains Python 3.7
conda create -n snakes python=3.7
  1. Activate new environment
conda activate snakes
  1. Use pip to install packages
pip install audio-to-midi azure-storage-blob flask google-cloud-storage gunicorn magenta timidity
  1. Run flask app
flask run

Congratulations, you just run the Flask app locally!


Expose Local Flask App to the Internet


  1. Enable incoming traffic for port 5000. This is done by navigating to Control Panel> System and Security > Windows Defender Firewall > Advanced Settings

Advanced Settings


  1. In Advanced Settings, click on Inbound Rules

  1. After clicking Inbound Rules, click on New Rules in the Action column

Inbound Rules


  1. In New Inbound Rule Wizard, select Rule Type as Port and click Next

New Inbound Rule Wizard


  1. In New Inbound Rule Wizard, apply rule to TCP and set specific local port to 5000 and click Next

Protocol and Ports


  1. In New Inbound Rule Wizard, specify action to Allow the connection and click Next

Action


  1. In New Inbound Rule Wizard, specify profile for which rule applies to Private

Profile


  1. Still in New Inbound Rule Wizard, specify name to Melofy API Port 500 and description to Allow inbound connection to local port 5000 using private connection and click Finish

Name


  1. Check New Inbound Rule in the list of Inbound Rules

Check New Inbound Rule

Congratulations, you just exposed local port 5000 to the Internet!


Start Ngrok


Basic Command


Expose a web server on port 5000 of your local machine to the Internet

ngrok http 5000

Advanced Commands


Expose a web server on port 5000 of your local machine to the Internet, set region to Asia Pasific, and subdomain to melofyapi

ngrok http -region=ap -hostname=melofyapi.ap.ngrok.io 5000

Congratulations, you can now access the API at http://melofyapi.ap.ngrok.io!



Examples of Azure Blob Storage Usage

melofy-api's People

Contributors

ariessa avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.