Home > Net >  Implementing Machine learning model into flutter app
Implementing Machine learning model into flutter app

Time:05-23

i have created a machine learning model that can predict laptop prices with python using GridSearchCV algorithm, i want to implement it into my flutter app, so that the user when he chooses his laptop specifications and hit "tap to predict" button, the estimated price will be shown. i don't know backend very well.My model with GridSearchCV algorithm enter image description here

my flutter app

enter image description here

CodePudding user response:

You can use http package to send the user input through a post request to the ML model and then show the response to the user on a new screen.

These if you are hosting the model separately if the model is shipped with the app just call it ontap of the button and return the results to the user.

CodePudding user response:

I don't know flutter very well but I can give some advice to make that possible:

1 - create flask socketio asynchronous service, using this documentation here

2 - then create a method that takes some specific messages like

from flask_socketio import send, emit

@socketio.on('doThePrediction')
def handle_message(message):

    prediction = pipe.predict(message)

    send(prediction)

to do the prediction of your model the message that comes from the mobile app must include the data which is for example "{Ram type": "8GB", "Screen refresh rate": "60hz"}"

3 - socket emits the prediction result on the web socket server, so you have to create a message listener function in the mobile app to listen to the webserver

4- take the message with that function and print it on the mobile app screen.

I hope it was understandable

  • Related