Search code examples
pythonfluttermachine-learninggridsearchcv

Implementing Machine learning model into flutter app


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 My model with Lasso regression

my flutter app

enter image description here


Solution

  • 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.