{"id":15159022,"url":"https://github.com/pratikkalein/deploy-tf-cloud-run","last_synced_at":"2026-02-14T15:32:01.621Z","repository":{"id":218122212,"uuid":"744999991","full_name":"pratikkalein/deploy-tf-cloud-run","owner":"pratikkalein","description":"Deploy TensorFlow models on Google Cloud Run","archived":false,"fork":false,"pushed_at":"2024-02-05T12:38:02.000Z","size":3245,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-11T10:05:48.908Z","etag":null,"topics":["google-cloud-platform","ml","strea","tensorflow","tensorflow-tutorials"],"latest_commit_sha":null,"homepage":"http://pratik.tech/tf-run-demo","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/pratikkalein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2024-01-18T12:47:32.000Z","updated_at":"2024-01-23T08:46:33.000Z","dependencies_parsed_at":"2024-02-05T13:56:00.328Z","dependency_job_id":null,"html_url":"https://github.com/pratikkalein/deploy-tf-cloud-run","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"7343afa6e288c7d54c8aacc9193436e8fce1759e"},"previous_names":["pratikkalein/deploy-tf-cloud-run"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pratikkalein/deploy-tf-cloud-run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikkalein%2Fdeploy-tf-cloud-run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikkalein%2Fdeploy-tf-cloud-run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikkalein%2Fdeploy-tf-cloud-run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikkalein%2Fdeploy-tf-cloud-run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pratikkalein","download_url":"https://codeload.github.com/pratikkalein/deploy-tf-cloud-run/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikkalein%2Fdeploy-tf-cloud-run/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29447989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T14:10:32.461Z","status":"ssl_error","status_checked_at":"2026-02-14T14:09:49.945Z","response_time":53,"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":["google-cloud-platform","ml","strea","tensorflow","tensorflow-tutorials"],"created_at":"2024-09-26T21:01:53.159Z","updated_at":"2026-02-14T15:32:01.604Z","avatar_url":"https://github.com/pratikkalein.png","language":"Python","readme":"\u003ch3 align=\"center\"\u003eMNIST Digit App\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    An end to end project which shows how to deploy a Tensorflow model on Google Cloud\n    \u003cbr /\u003e\n    \u003ca href=\"http://pratik.tech/tf-run-demo\"\u003e\u003cstrong\u003eView Demo »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n\u003c/div\u003e\n\n## About The Project\n\n![Screenshot](streamlit.png)\nThis project demonstrates how to train a ML model with TensorFlow and deploy the model to Google Cloud Run with the help of Cloud Build and Docker.\n\n## Built With\n\n![Python](https://img.shields.io/badge/python-000000?style=for-the-badge\u0026logo=python)\n![Flask](https://img.shields.io/badge/Flask-000000?style=for-the-badge\u0026logo=flask)\n![Flask](https://img.shields.io/badge/Google%20Cloud-000000?style=for-the-badge\u0026logo=googlecloud)\n![Flask](https://img.shields.io/badge/streamlit-000000?style=for-the-badge\u0026logo=streamlit)\n\n## Getting Started\n\nSet up the project locally.\n\n### Prerequisites\n\n1. Python\n2. Pip\n3. [Google Cloud SDK](https://cloud.google.com/sdk/docs/install)\n\n### Installation\n\n1. Clone the repo\n   ```sh\n   git clone https://github.com/pratikkalein/deploy-tf-cloud-run.git\n   ```\n2. Create and activate virtual environment\n\n   ```sh\n   python3 -m venv venv\n   source venv/bin/activate\n   ```\n\n3. Install requirements.txt\n   ```sh\n   pip install -r requirements.txt\n   ```\n\n### Train the model\n\n1. Open and run the 01-train.py file\n\n   ```sh\n   python3 01-train.py\n   ```\n\n   You can try playing with the batch size and epochs. Once the training is done a `.keras` file will be saved into the root directory.\n\n2. Run the 02-load.py file to load and test the output of the model.\n   ```sh\n   python3 02-load.py\n   ```\n\n### Deploying the Flask app\n\n1. Change your current working directory to `deploy`\n\n   ```shell\n   cd deploy\n   ```\n\n2. Make sure you are authenticated with gcloud CLI\n\n   ```shell\n   gcloud auth login\n   ```\n\n   Your default browser will open once you run this command. Choose your Google account.\n\n3. Observe the 03-main.py file to understand how the flask API is working. Start the build using gcloud CLI.\n   ```shell\n   gcloud builds submit --tag gcr.io/\u003cproject_id\u003e/\u003cfunction_name\u003e\n   ```\n   It usually takes 3-4 mins to build.\n4. Once the build is done deploy to cloud run.\n   ```shell\n   gcloud run deploy --image gcr.io/\u003cproject_id\u003e/\u003cfunction_name\u003e --platform managed\n   ```\n   It usually takes 3-4 mins to deploy.\n5. Go to [Google Cloud Console](https://console.cloud.google.com/run) and open Cloud run. You can find the URL endpoint.\n\n### Testing\n\n1. Open the 04-st-app.py and add the URL you got from Cloud run and paste it at the location mentioned in the file.\n2. Run the file.\n   ```shell\n   streamlit run 04-st-app.py\n   ```\n3. Upload the image and test the prediction output.\n\n## License\n\nDistributed under the MIT License. See `LICENSE.txt` for more information.\n\n## Contact\n\nPratik Kale\n\nTwitter - [@pratikkalein](https://twitter.com/pratikkalein) LinkedIn- [/in/pratikkalein]()\n\nppvkale@gmail.com\n\nProject Link: [https://github.com/pratikkalein/deploy-tf-cloud-run](https://github.com/pratikkalein/deploy-tf-cloud-run)\nDemo Link : [http://pratik.tech/tf-run-demo](http://pratik.tech/tf-run-demo)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratikkalein%2Fdeploy-tf-cloud-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpratikkalein%2Fdeploy-tf-cloud-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratikkalein%2Fdeploy-tf-cloud-run/lists"}