{"id":32490109,"url":"https://github.com/amirziai/sklearnflask","last_synced_at":"2025-10-27T08:31:51.222Z","repository":{"id":40680447,"uuid":"50692313","full_name":"amirziai/sklearnflask","owner":"amirziai","description":"Flask API for training and predicting using scikit learn models","archived":false,"fork":false,"pushed_at":"2023-02-24T08:22:40.000Z","size":107,"stargazers_count":299,"open_issues_count":5,"forks_count":129,"subscribers_count":21,"default_branch":"master","last_synced_at":"2023-11-07T17:08:59.005Z","etag":null,"topics":["flask","scikit-learn"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amirziai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-29T21:24:26.000Z","updated_at":"2023-11-07T12:41:33.000Z","dependencies_parsed_at":"2022-09-01T06:41:44.364Z","dependency_job_id":null,"html_url":"https://github.com/amirziai/sklearnflask","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/amirziai/sklearnflask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirziai%2Fsklearnflask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirziai%2Fsklearnflask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirziai%2Fsklearnflask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirziai%2Fsklearnflask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amirziai","download_url":"https://codeload.github.com/amirziai/sklearnflask/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirziai%2Fsklearnflask/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281239343,"owners_count":26467073,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"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":["flask","scikit-learn"],"created_at":"2025-10-27T08:30:27.570Z","updated_at":"2025-10-27T08:31:51.216Z","avatar_url":"https://github.com/amirziai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask API for scikit learn\nA simple Flask application that can serve predictions from a scikit-learn model. Reads a pickled sklearn model into memory when the Flask app is started and returns predictions through the /predict endpoint. You can also use the /train endpoint to train/retrain the model. Any sklearn model can be used for prediction.\n\nRead more in [this blog post](https://medium.com/@amirziai/a-flask-api-for-serving-scikit-learn-models-c8bcdaa41daa).\n\n### Dependencies\n- scikit-learn\n- Flask\n- pandas\n- numpy\n\n```\npip install -r requirements.txt\n```\n\n### Running API\n```\npython main.py \u003cport\u003e\n```\n\n# Endpoints\n### /predict (POST)\nReturns an array of predictions given a JSON object representing independent variables. Here's a sample input:\n```\n[\n    {\"Age\": 85, \"Sex\": \"male\", \"Embarked\": \"S\"},\n    {\"Age\": 24, \"Sex\": \"female\", \"Embarked\": \"C\"},\n    {\"Age\": 3, \"Sex\": \"male\", \"Embarked\": \"C\"},\n    {\"Age\": 21, \"Sex\": \"male\", \"Embarked\": \"S\"}\n]\n```\n\nand sample output:\n```\n{\"prediction\": [0, 1, 1, 0]}\n```\n\n\n### /train (GET)\nTrains the model. This is currently hard-coded to be a random forest model that is run on a subset of columns of the titanic dataset.\n\n### /wipe (GET)\nRemoves the trained model.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirziai%2Fsklearnflask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famirziai%2Fsklearnflask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirziai%2Fsklearnflask/lists"}