{"id":22506559,"url":"https://github.com/a-poor/flask-celery-api","last_synced_at":"2026-04-16T03:32:06.692Z","repository":{"id":104407945,"uuid":"322721147","full_name":"a-poor/flask-celery-api","owner":"a-poor","description":"This is a quick proof of concept for creating a Flask web API as a front-end for long-running tasks -- like making ML model predictions.","archived":false,"fork":false,"pushed_at":"2020-12-21T22:24:27.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-22T16:34:16.973Z","etag":null,"topics":["api","celery","docker","flask"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a-poor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-18T22:47:34.000Z","updated_at":"2024-02-22T19:17:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"c579f93e-25e3-4e80-bbad-0c1464ad56c9","html_url":"https://github.com/a-poor/flask-celery-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/a-poor/flask-celery-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-poor%2Fflask-celery-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-poor%2Fflask-celery-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-poor%2Fflask-celery-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-poor%2Fflask-celery-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a-poor","download_url":"https://codeload.github.com/a-poor/flask-celery-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a-poor%2Fflask-celery-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","celery","docker","flask"],"created_at":"2024-12-07T00:44:30.005Z","updated_at":"2026-04-16T03:32:06.655Z","avatar_url":"https://github.com/a-poor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask APIs for Long-Running Tasks using Celery\r\n\r\n_created by Austin Poor_\r\n\r\n\r\n## About\r\n\r\nThis is a quick proof of concept for creating a [Flask](https://flask.palletsprojects.com) web API as a front-end for long-running tasks -- like making ML model predictions.\r\n\r\nIt uses the distributed task queue, [Celery](https://docs.celeryproject.org), to pass heavy processing off to worker nodes while freeing up the Flask server for handling requests.\r\n\r\nWhen a user makes a request, the API diverts the processing to a Celery worker and responds with a location where the result will be stored when the processing is complete.\r\n\r\n\r\n## Instructions for Use\r\n\r\nYou can start redis, celery, and the flask api with the included dockerfiles and docker-compose file (with the command `$ docker-compose up`) or you can do the following:\r\n\r\n1. Install the required packages in [requirements.txt](./requirements.txt), if necessary.\r\n2. Run [build-model.py](./build-model.py) to train a `scikit-learn` logistic regression model on the iris dataset and then save it to the `models/` directory.\r\n3. Start up Redis on port `6379`\r\n4. Start up Celery with the command: `$ celery -A tasks worker`\r\n5. Run [app.py](./app.py) to start up the `Flask` server\r\n\r\nThen, the API will be up and running at: [http://localhost:5000/](http://localhost:5000/help)\r\n\r\nYou can test the server by running [test-api.py](./test-api.py).\r\n\r\n\r\n## References\r\n\r\n1. https://blog.miguelgrinberg.com/post/using-celery-with-flask\r\n2. https://docs.celeryproject.org/en/stable/getting-started/first-steps-with-celery.html\r\n3. https://docs.celeryproject.org/en/latest/userguide/tasks.html#instantiation\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-poor%2Fflask-celery-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa-poor%2Fflask-celery-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa-poor%2Fflask-celery-api/lists"}