Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Mr4sR/BE_GarudaCoders

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hapi.js TensorFlow.js API

This project is a simple API built using Hapi.js that integrates with a TensorFlow.js machine learning model. It provides endpoints for loading the model and making predictions.

Project Structure

hapi-tfjs-api
├── src
│   ├── server.js            # Entry point of the application
│   ├── routes
│   │   └── model.js         # API routes for the TensorFlow model
│   ├── controllers
│   │   └── modelController.js # Controller for handling model requests
│   ├── services
│   │   └── tensorflowService.js # Service for TensorFlow model interactions
│   └── types
│       └── index.d.ts       # TypeScript types and interfaces
├── package.json              # NPM configuration file
└── README.md                 # Project documentation

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd hapi-tfjs-api
    
  2. Install dependencies:

    npm install
    

Usage

To start the server, run:

node src/server.js

The server will start and listen for incoming requests.

API Endpoints

Load Model

  • Endpoint: POST /model/load
  • Description: Loads the TensorFlow.js model.
  • Request Body:
    {
      "modelPath": "path/to/model.json"
    }
  • Response:
    {
      "message": "Model loaded successfully"
    }

Predict

  • Endpoint: POST /model/predict
  • Description: Makes a prediction using the loaded model.
  • Request Body:
    {
      "inputData": [1, 2, 3, 4]
    }
  • Response:
    {
      "prediction": [0.5, 0.2, 0.3]
    }

Contributing

Feel free to submit issues or pull requests for improvements or bug fixes.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published