Skip to content

Repository ini digunakan untuk demo Bangkit 2023 H2 Guest Speaker Session mengenai tutorial membuat API untuk menangani inference machine learning.

Notifications You must be signed in to change notification settings

dicodingacademy/simple-api-tensorflowjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About this repo

This repo is used for demo Bangkit Guest Speaker Session H2. The topic is about how to create API for machine learning inference.

Dependencies Project (main branch)

  1. Hapi Framework
  2. Tensorflow.js

Machine Learning Model

The model was made from course "Belajar Machine Learning untuk Pemula" and exported as Keras Model (.h5). After that, because this demo is use tensorflowjs, the model should be convert to tensorflow.js model.

Here is the code in Python how to convert keras model (.h5) to tensorflow.js model. Make sure your tensorflow.js already installed on your local computer.

from tensorflow.keras.models import load_model
import tensorflowjs as tfjs

model_path = load_model("<Path to your model>")
output_path = "<Output path after your model is converted>"

tfjs.converters.save_keras_model(model_path, output_path)

Or you can use bash.

tensorflowjs_converter --input_format=keras <path to your model> <output_path>

Installation

If you want to try this project,

  1. Clone this project
git clone https://github.com/dicodingacademy/simple-api-tensorflowjs.git
  1. Install dependencies
npm i
  1. Run development script
npm run dev

Deploy to Compute Engine Instance

Follow this step to deploy the apps to Compute Engine Instance

  1. Set firewall rule

Set the firewall rule for port 3000 (because this server is running on port 3000).

  1. Create your instance

Create your instance based on your preference and apply the firewall rule via target tags.

  1. Connect to the instance via SSH.
  2. Install Nodejs
  3. Follow the installation steps.

About

Repository ini digunakan untuk demo Bangkit 2023 H2 Guest Speaker Session mengenai tutorial membuat API untuk menangani inference machine learning.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published