This project implements a backend API for image prediction of maggots. The application uses Flask for handling web requests and TensorFlow for the prediction model.
| Student ID | Name | University |
|---|---|---|
| C296B4KY2742 | Muhammad Arizaldi Eka Prasetya | Universitas Pembangunan Nasional "Veteran" Jawa Timur |
| C296B4KX0841 | Berlian Viga Septiani | Universitas Pembangunan Nasional "Veteran" Jawa Timur |
- Predict Maggot Image
- Cloud SQL with database engine MySQL
- Cloud Storage
- Cloud Run
- Artifact Registry
- Secret Manager
PROJECT ROOT
├── app
│ ├── server
│ │ ├── handler.py
│ │ └── routes.py
│ └── services
│ ├── inferenceServices.py
│ ├── initModel.py
│ ├── loadModel.py
│ └── storeData.py
├── app.py
├── myenv
├── .env
├── .gitignore
├── env.example
└── requirements.txt
README.mdIf Python is not yet installed, you can download and install it from official python website
# check python version
$ python --version
# install virtual environment
$ pip install virtualenv
# create virtual environment
$ virtualenv myenv
# for windows, activate use
$ myenv\Scripts\activate
# install flask
$ pip install flaskhttps://github.com/Capstone-MaggotIn/Cloud-Computing-2.git$ pip install -r requirements.txt- Edit .env files and specify with your env.examples
- Run the app
$ python app.pyTo set up and deploy the backend model application, first clone the source code from the specified GitHub repository and navigate to the project directory. Create a Dockerfile to define the container configuration details can be found at Dockerfile. Ensure that the required Google Cloud APIs, including Artifact Registry, Cloud Build, and Cloud Run, are enabled. Next, create an Artifact Registry repository to store the Docker image. Build the container image using the Dockerfile, then upload it to Artifact Registry using the gcloud builds submit command. Finally, deploy the application to Cloud Run using the created container image for scalable and serverless hosting with the gcloud run deploy command.
POST /predict
- Endpoint : /predict
- Method : POST
- Example Request
Content-Type: multipart/form-data
image: [maggot_image.jpg]
- Status Code :
200 - Content Type :
application/json - Result Response
{
"status": "true",
"message": "Model is predicted successfully",
"data": {
"id": "e326e8e5-ce70-46e9-8369-f3dc6fd43740",
"result": 5,
"phase": "Prepupa",
"confidenceScore": 76.68556213378906,
"created_at": "2024-12-08T17:35:04.827625"
}
- Planning costs via Google Cloud Pricing Calculator
- Cloud Architecture
- Visit the Flask Documentation to learn more about the framework
This repository's source code is available under MIT License.