{"id":22799084,"url":"https://github.com/thomd/spam-detection-with-fastapi-on-azure","last_synced_at":"2026-05-09T09:39:13.346Z","repository":{"id":66830102,"uuid":"430414638","full_name":"thomd/spam-detection-with-fastapi-on-azure","owner":"thomd","description":"Train a spam-detection model with SciKit-Learn and deploy as FastAPI app on Azure Container Instance","archived":false,"fork":false,"pushed_at":"2021-11-24T09:09:28.000Z","size":218,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-05T21:42:34.754Z","etag":null,"topics":["azure","docker","machine-learning","python"],"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/thomd.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":"2021-11-21T16:08:34.000Z","updated_at":"2022-09-19T11:20:02.000Z","dependencies_parsed_at":"2023-03-26T14:51:25.341Z","dependency_job_id":null,"html_url":"https://github.com/thomd/spam-detection-with-fastapi-on-azure","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Fspam-detection-with-fastapi-on-azure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Fspam-detection-with-fastapi-on-azure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Fspam-detection-with-fastapi-on-azure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomd%2Fspam-detection-with-fastapi-on-azure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomd","download_url":"https://codeload.github.com/thomd/spam-detection-with-fastapi-on-azure/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246365651,"owners_count":20765549,"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","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":["azure","docker","machine-learning","python"],"created_at":"2024-12-12T07:07:52.129Z","updated_at":"2026-05-09T09:39:13.314Z","avatar_url":"https://github.com/thomd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spam Detection with SciKit-Learn, FastAPI on Azure Container Instance\n\n## Dataset\n\nThe UCI [SMS Spam Collection](https://data.world/uci/sms-spam-collection) is a public\nset of SMS labeled messages that have been collected for mobile phone spam research.\n\n## Setup\n\nCreate environment:\n\n    conda create --name spam\n    conda activate spam\n    conda install --yes --file requirements.txt\n\nTrain spam classifier model:\n\n    python train.py\n\nFor local testing, start server and open SwaggerUI\n\n    uvicorn app:app --reload\n    open http://localhost:8000/docs\n\nTest local endpoint:\n\n    curl http://localhost:8000/predict?message=I want your Money\n\n## Build Docker Image\n\nBuild docker image and run docker container:\n\n    docker build -t spam .\n    docker run -d --rm --name spam -p 80:80 spam\n\n## Deploy as Azure Container Instance\n\nUse Azure Container Instances (ACI) to run serverless Docker containers in Azure.\n\nCreate Azure Container Registry (ACR):\n\n    az login\n    az group create -n \u003cgroup\u003e -l \u003clocation\u003e\n    az acr create -g \u003cgroup\u003e -n \u003creg\u003e --sku Basic --admin-enabled true\n    az acr list -g \u003cgroup\u003e -o table\n\nUpload docker image to ACR\n\n    docker tag spam \u003creg\u003e.azurecr.io/spam:v1\n    az acr login -n \u003creg\u003e\n    docker push \u003creg\u003e.azurecr.io/spam:v1\n\nCreate container (find username and password here: Portal \u003e Container Registry \u003e Access Keys)\n\n    az container create -g \u003cgroup\u003e -n \u003ccontainer\u003e --image \u003creg\u003e.azurecr.io/spam:v1 --dns-name-label \u003clabel\u003e --ports 80\n    az container show -g \u003cgroup\u003e -n \u003ccontainer\u003e --query \"{FQDN:ipAddress.fqdn,ProvisioningState:provisioningState}\"\n    az container logs -g \u003cgroup\u003e -n \u003ccontainer\u003e\n\nOpen SwaggerUI\n    \n    open http://\u003clabel\u003e.\u003clocation\u003e.azurecontainer.io\n\nDelete resource group\n    \n    az group delete -n \u003cgroup\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomd%2Fspam-detection-with-fastapi-on-azure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomd%2Fspam-detection-with-fastapi-on-azure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomd%2Fspam-detection-with-fastapi-on-azure/lists"}