{"id":20360622,"url":"https://github.com/davidgasquez/moser","last_synced_at":"2026-03-04T18:02:46.750Z","repository":{"id":48338698,"uuid":"66544213","full_name":"davidgasquez/moser","owner":"davidgasquez","description":":postbox: A simple way to serve your Machine Learning models.","archived":false,"fork":false,"pushed_at":"2021-07-30T16:15:38.000Z","size":51,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T03:58:44.488Z","etag":null,"topics":["machine-learning","python","scikit-learn"],"latest_commit_sha":null,"homepage":"","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/davidgasquez.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-08-25T09:21:48.000Z","updated_at":"2018-12-13T12:07:09.000Z","dependencies_parsed_at":"2022-08-26T02:41:03.414Z","dependency_job_id":null,"html_url":"https://github.com/davidgasquez/moser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidgasquez/moser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgasquez%2Fmoser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgasquez%2Fmoser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgasquez%2Fmoser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgasquez%2Fmoser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidgasquez","download_url":"https://codeload.github.com/davidgasquez/moser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidgasquez%2Fmoser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30088339,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T15:40:14.053Z","status":"ssl_error","status_checked_at":"2026-03-04T15:40:13.655Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["machine-learning","python","scikit-learn"],"created_at":"2024-11-14T23:42:21.135Z","updated_at":"2026-03-04T18:02:46.694Z","avatar_url":"https://github.com/davidgasquez.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Moser: A Model Server Prototype\n\nMoser is a simple way to serve your Machine Learning models. The goal of Moser\nis making super easy to setup any kind of predictive model in a production\nserver and being able to interact with them through RESTful API calls.\n\n## Features\n\n- Set Models\n- Set Functions\n\n## Get Started\n\nYou can test it running the container (`make`) and heading\nto [http://localhost:5000](http://localhost:5000)\n\n1. Generate the model `pkl`\n2. Build the container `make build`\n3. Run the API with `make`\n4. Make some requests to [http://localhost:5000](http://localhost:5000):\n    - Add a model to the API with a `PUT` call to `/api/models/your_model_name`\n    - Use the previous model calling `/api/models/your_model_name/predict` with\n      a `POST` request providing a single JSON with the feature names and\n      values.\n\n### Example\n\nGenerate the `pkl` file using `joblib`:\n\n```python\nimport pandas as pd\nimport numpy as np\nfrom sklearn.datasets import load_iris\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.externals import joblib\n\niris = load_iris()\ndata = pd.DataFrame(data=np.c_[iris['data'], iris['target']],\n                    columns=iris['feature_names'] + ['target'])\n\nclf = RandomForestClassifier()\nclf.fit(data.drop('target', axis=1), data['target'])\n\njoblib.dump(clf, 'model.pkl', compress=9)\n```\n\nOnce we have the file we need to run the server with `make` and make some API\nrequests:\n\n```python\nimport requests\n\nbase_url = 'http://localhost:5000'\n\nfilename = 'model.pkl'\n\n# Set the model\nwith open(filename, 'rb') as f:\n    model = f.read()\n    r = requests.put(base_url + '/api/models/iris', data=model)\n    print(r)\n\n# Make predictions from JSON\ndata = {\n    \"features\": [\"sepal_length\", \"sepal_width\", \"petal_length\", \"petal_width\"],\n    \"values\": [\n        [1, 4, 1, 1],\n        [2, 0, 6, 1],\n        [1, 4, 8, 1]\n    ]\n}\nr = requests.post(base_url + '/api/models/iris/predict', json=data)\nprint(r, r.json())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidgasquez%2Fmoser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidgasquez%2Fmoser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidgasquez%2Fmoser/lists"}