Project Foedtra - Bangkit 2022 Cloud Computing Capstone
Project Foedtra: Revolutionizing Indonesian Culinary Discovery
Published by Ardhi Ramadhani on June 13, 2022
Introduction
Foedtra is a cutting-edge application that bridges the gap between traditional Indonesian cuisine and modern technology. By leveraging advanced machine learning and cloud computing, Foedtra aims to predict and provide detailed information about traditional foods from user-uploaded images, while also recommending nearby restaurants that serve these dishes.
Background
In recent years, Indonesia has witnessed a significant shift in eating habits, largely influenced by the rapid expansion of global food chains. This trend has led to a concerning unfamiliarity with the rich variety of traditional Indonesian foods among both locals and tourists.
Research indicates that hundreds of global food brands are reshaping local dining preferences, potentially overshadowing the diverse and flavorful landscape of Indonesian cuisine. This situation presents both a challenge and an opportunity:
- Challenge: Preserving and promoting awareness of Indonesia's culinary heritage.
- Opportunity: Harnessing technology to reintroduce and celebrate traditional foods, while supporting local vendors and boosting culinary tourism.
Recognizing this, the Indonesian government has, over the past five years, intensified its support for culinary tourism as a key component of its international tourism strategy. Foedtra aligns perfectly with this initiative, offering an innovative solution to detect, recommend, and educate users about Indonesian foods.
Technical Implementation
Cloud Architecture and Data Flow
Foedtra's robust cloud-based architecture seamlessly integrates several key components:
- Mobile App: The user-friendly interface for image uploads and receiving recommendations.
- Backend API (Node.js): The central coordinator managing communication between all services.
- ML API (Flask): Handles image processing and food recognition using advanced machine learning models.
- Places API: Sources nearby restaurant information based on user location.
The data flow follows a streamlined process:
- User uploads an image via the mobile app.
- Backend API receives the image and location data.
- ML API processes the image for food recognition.
- Places API is queried for relevant restaurant recommendations.
- Compiled results are sent back to the user through the mobile app.
This architecture ensures efficient processing, accurate recognition, and personalized recommendations, all while maintaining scalability and responsiveness.
Backend API Infrastructure
Foedtra's Backend API leverages modern technologies and Google Cloud Platform services:
-
Core Technologies:
- Express.js and Node.js for efficient server-side operations
- Terraform for Infrastructure as Code (IaC)
-
GCP Services:
- Cloud Build for automated CI/CD
- Container Registry for Docker image management
- Cloud Run for serverless container deployment
- Secret Manager for secure credential storage
-
Deployment Pipeline:
- Triggered by GitHub pushes
- Automated build and deployment process
- Containerization for consistency across environments
This setup ensures a secure, efficient, and scalable backend infrastructure.
Link to Repository
Link to the repository: backend-foedtra repository
How I Deploy this Backend API
1. Open Google Cloud Build
- Navigate to Cloud Build from the Google Cloud Console.
- Ensure that you have the necessary permissions to configure build triggers and deploy services.
2. Create a Secret in Google Secret Manager
- Go to Secret Manager (found under Security in the left-hand sidebar).
- Click on Create Secret.
- Name: Provide a name for the secret (e.g., my-secret).
- Secret value: Paste the secret content or value (e.g., API keys, credentials).
- Click Create Secret to save the new secret
Note: You can also choose the replication policy, such as automatic replication across multiple regions, based on your project requirements.
3. Navigate to Cloud Build Triggers
- Return to Cloud Build by selecting it from the navigation menu.
- Choose Triggers from the dashboard.
- Click Create Trigger to set up a new build trigger.r.
4. Configure the Trigger Details
- Under Repository, connect your source code repository (e.g., GitHub, GitLab, etc.).
- Ensure that you have integrated your repository with GCP (this may involve authorizing Cloud Build to access your repository).
- Event: Select the event that will trigger the build (e.g., Push to a branch, Pull request, or Tag creation).
- Branch/Tag: Specify the branch (e.g., main, master) where the build should be triggered.
5. Define Build Configuration
- Choose how to provide the build configuration:
- You can either use an existing cloudbuild.yaml file from the repository or manually specify build steps.
Example cloudbuild.yaml (for Docker-based deployment):
6. Add Environment Variables (Secrets)
- Under Advanced options, select the Secrets created in Secret Manager.
- These secrets can be injected into your build process or container as environment variables or files during the build.
7. Finalize and Deploy
- Once your configuration is complete, click Create Trigger to finalize the setup.
- On push or other specified events (as per your trigger configuration), Cloud Build will run the build, execute the defined steps, and deploy your service.
Additional Resources
For detailed instructions and visual aids, you can refer to the picture step-by-step guide found in the backend-foedtra repository.
Machine Learning API Infrastructure
The ML component utilizes:
-
Core Technologies:
- TensorFlow for the food recognition model
- Flask for API creation
- Docker for containerization
-
Deployment Process:
- Packaging the TensorFlow model and Flask API into a Docker container
- Deployment on Google Cloud Run
This infrastructure allows for efficient scaling and handling of food recognition requests, leveraging the benefits of containerization and serverless architecture.
Link to Repository
Links to the repositories:
How i Deploy the ML API in Cloud Run via Cloud Console
Build Docker image Cloud shell
- Docker build -t gcr.io/$MY_PROJECT_ID/foedtra-ml:v1 -f Dockerfile .
- docker push gcr.io/$MY_PROJECT_ID/foedtra-ml:v1
Deploy in Cloud Run
Via Cloud Console
- Container image URL -> Select Docker Image
- Container port = 8080
- Memory = 4 GiB
- CPU = 2
- Execution environment = Second generation
- Auto Scalling =
- Minimum instances = 1
- Maximum instances = 5
Via Cloud Shell or Terminal/CMD VsCode with Cloud SDK
- Open Cloud Shell/Terminal
- gcloud init -> Select account and Project
Android Design
The Foedtra Android app features a user-friendly interface with a distinctive mustard yellow color scheme. Key features include:
- Firebase Authentication: Secure user login and account management.
- Food Recognition: A prominent "+" button for capturing or uploading food images, initiating the prediction process.
- Detailed Food Information: Displays information about recognized dishes, including origin and cultural significance.
- Restaurant Recommendations: Provides a list of nearby restaurants serving the recognized dish, with map integration.
- Intuitive Navigation: Clean, card-based design for easy browsing.
The app's design facilitates easy food recognition and discovery while creating an engaging and educational experience for users exploring Indonesian cuisine.
Link to Repository
Link to the repository: android repository
Conclusion
Foedtra represents a significant step towards preserving and promoting Indonesian culinary heritage. By combining advanced technology with cultural appreciation, we're not only helping users discover traditional foods but also supporting local businesses and enhancing culinary tourism.