-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added link for predictAPI + integrated model
- Loading branch information
1 parent
906221b
commit 0a97701
Showing
19 changed files
with
131 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const mongoose = require('mongoose') | ||
|
||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Input: [[Food Item: String, Temperature: Float]] | ||
Output: [Prediction(Days): Int] |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import joblib | ||
import warnings | ||
warnings.filterwarnings("ignore") | ||
import pandas as pd | ||
|
||
|
||
|
||
model = joblib.load('./model/fsp_model.pkl'); | ||
prediction = model.predict([[2, 23,5]]); | ||
print(prediction) | ||
|
||
|
||
pred = model.predict(testFd)[0] | ||
print(pred) | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,16 @@ | ||
const express = require('express') | ||
const predictionRouter = express.Router(); | ||
const { InferenceSession, Tensor } = require('onnxruntime-node'); | ||
const express = require('express') | ||
const predictRouter = express.Router(); | ||
const axios = require('axios') | ||
|
||
const predictPATH = 'http://127.0.0.1:8023/temp/' | ||
|
||
|
||
async function predictSpoilage(temp, responder){ | ||
// Create a new InferenceSession | ||
const session = new InferenceSession(); | ||
|
||
// Load the ONNX model | ||
await session.loadModel('./../../model/fsp_model.onnx'); | ||
|
||
// Prepare input data (replace inputData with your actual input data) | ||
const inputData = new Float32Array([32.65]); | ||
|
||
// Create an input Tensor | ||
const inputTensor = new Tensor('float32', inputData, [1, inputData.length]); | ||
|
||
// Run the model | ||
const outputMap = await session.run([inputTensor]); | ||
|
||
// Get the output tensor | ||
const outputTensor = outputMap.values().next().value; | ||
|
||
// Access the predictions | ||
const predictions = outputTensor.data; | ||
console.log(predictions); | ||
} | ||
|
||
|
||
predictionRouter.post('/predict/', (req,res)=>{ | ||
const temp = req.body.temp; | ||
predictSpoilage(temp, res) | ||
predictRouter.post('/temp/', (req,res)=>{ | ||
axios.post(predictPATH, req.body).then(result=>{ | ||
res.json(result.data) | ||
}) | ||
}) | ||
|
||
|
||
|
||
module.exports = predictionRouter; | ||
module.exports = predictRouter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
start cmd /k "cd predictAPI && uvicorn main:app --reload --port 8023" | ||
npm run server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Input: [[Food Item: String, Temperature: Float]] | ||
Output: [Prediction(Days): Int] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters