is there any code refrance avliable to deploy a model RandomForestClassifier using Flask [duplicate]Post JSON using Python RequestsHow to get POSTed json in Flask?Is there any way to kill a Thread?Configure Flask dev server to be visible across the networkHow to get data received in Flask requestHow do you get a query string on Flask?Return JSON response from Flask viewHow to serve static files in FlaskError processing Json requestTwitter oauth with flask_oauthlib, Failed to generate request tokenFlask POSTs with Trailing SlashERROR : TypeError: Object of type 'int64' is not JSON serializable and json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Is there a way to save this session?

How do I get a cleat that's stuck in a pedal, detached from the shoe, out?

Can I ask a publisher for a paper that I need for reviewing

Is American Express widely accepted in France?

What are the problems in teaching guitar via Skype?

Are grass strips more dangerous than tarmac?

How should I push back against my job assigning "homework"?

What does it mean by "d-ism of Leibniz" and "dotage of Newton" in simple English?

How crucial is a waifu game storyline?

Is it possible to kill all life on Earth?

Can a helicopter mask itself from Radar?

What should I do about a religious player who refuses to accept the existence of multiple gods in D&D?

Explain Ant-Man's "not it" scene from Avengers: Endgame

Humans meet a distant alien species. How do they standardize? - Units of Measure

What people are called "кабан" and why?

PhD student with mental health issues and bad performance

Why is there a need to modify system call tables in Linux?

Accidentally cashed a check twice

What does War Machine's "Canopy! Canopy!" line mean in "Avengers: Endgame"?

What caused the tendency for conservatives to not support climate change regulations?

Can you please explain this joke: "I'm going bananas is what I tell my bananas before I leave the house"?

Why use water tanks from a retired Space Shuttle?

Creating Fictional Slavic Place Names

How can I offer a test ride while selling a bike?



is there any code refrance avliable to deploy a model RandomForestClassifier using Flask [duplicate]


Post JSON using Python RequestsHow to get POSTed json in Flask?Is there any way to kill a Thread?Configure Flask dev server to be visible across the networkHow to get data received in Flask requestHow do you get a query string on Flask?Return JSON response from Flask viewHow to serve static files in FlaskError processing Json requestTwitter oauth with flask_oauthlib, Failed to generate request tokenFlask POSTs with Trailing SlashERROR : TypeError: Object of type 'int64' is not JSON serializable and json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0
















This question already has an answer here:



  • Post JSON using Python Requests

    6 answers



  • How to get POSTed json in Flask?

    5 answers



I want to deploy a model RandomForestClassifier using Flask.
I got reference in git hub-https://github.com/a-djebali/flask-machine-learning-resful



but when I send request to service it will not work instead error given,



Request.py code below



import requests
import json
import numpy as np



url = "http://127.0.0.1:9000/predict_api"
data = json.dumps('sl':5.84,'sw':3.0,'pl':3.75,'pw':1.1)
r = requests.post(url,data)
print(r.json())


for post app.py
Below Code



import numpy as np
from flask import Flask, abort, jsonify, request
import pickle as pickle

random_forest_model = pickle.load(open("rfc.pkl","rb"))

app = Flask(__name__)

@app.route('/predict_api', methods=['POST'])
def predict():
# Error checking
data = request.get_json(force=True)

# Convert JSON to numpy array
predict_request = [data['sl'],data['sw'],data['pl'],data['pw']]
predict_request = np.array(predict_request)

# Predict using the random forest model
y = random_forest_model.predict(predict_request)

# Return prediction
output = [y[0]]
return jsonify(results=output)

if __name__ == '__main__':
app.run(port = 9000, debug = True)


Error Message




File "C:Anacondalibjsondecoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None



JSONDecodeError: Expecting value




is any body try to use Flask web service please help me










share|improve this question















marked as duplicate by davidism python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 24 at 14:47


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
























    0
















    This question already has an answer here:



    • Post JSON using Python Requests

      6 answers



    • How to get POSTed json in Flask?

      5 answers



    I want to deploy a model RandomForestClassifier using Flask.
    I got reference in git hub-https://github.com/a-djebali/flask-machine-learning-resful



    but when I send request to service it will not work instead error given,



    Request.py code below



    import requests
    import json
    import numpy as np



    url = "http://127.0.0.1:9000/predict_api"
    data = json.dumps('sl':5.84,'sw':3.0,'pl':3.75,'pw':1.1)
    r = requests.post(url,data)
    print(r.json())


    for post app.py
    Below Code



    import numpy as np
    from flask import Flask, abort, jsonify, request
    import pickle as pickle

    random_forest_model = pickle.load(open("rfc.pkl","rb"))

    app = Flask(__name__)

    @app.route('/predict_api', methods=['POST'])
    def predict():
    # Error checking
    data = request.get_json(force=True)

    # Convert JSON to numpy array
    predict_request = [data['sl'],data['sw'],data['pl'],data['pw']]
    predict_request = np.array(predict_request)

    # Predict using the random forest model
    y = random_forest_model.predict(predict_request)

    # Return prediction
    output = [y[0]]
    return jsonify(results=output)

    if __name__ == '__main__':
    app.run(port = 9000, debug = True)


    Error Message




    File "C:Anacondalibjsondecoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None



    JSONDecodeError: Expecting value




    is any body try to use Flask web service please help me










    share|improve this question















    marked as duplicate by davidism python
    Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

    StackExchange.ready(function()
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function()
    $hover.showInfoMessage('',
    messageElement: $msg.clone().show(),
    transient: false,
    position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
    dismissable: false,
    relativeToBody: true
    );
    ,
    function()
    StackExchange.helpers.removeMessages();

    );
    );
    );
    Mar 24 at 14:47


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.




















      0












      0








      0









      This question already has an answer here:



      • Post JSON using Python Requests

        6 answers



      • How to get POSTed json in Flask?

        5 answers



      I want to deploy a model RandomForestClassifier using Flask.
      I got reference in git hub-https://github.com/a-djebali/flask-machine-learning-resful



      but when I send request to service it will not work instead error given,



      Request.py code below



      import requests
      import json
      import numpy as np



      url = "http://127.0.0.1:9000/predict_api"
      data = json.dumps('sl':5.84,'sw':3.0,'pl':3.75,'pw':1.1)
      r = requests.post(url,data)
      print(r.json())


      for post app.py
      Below Code



      import numpy as np
      from flask import Flask, abort, jsonify, request
      import pickle as pickle

      random_forest_model = pickle.load(open("rfc.pkl","rb"))

      app = Flask(__name__)

      @app.route('/predict_api', methods=['POST'])
      def predict():
      # Error checking
      data = request.get_json(force=True)

      # Convert JSON to numpy array
      predict_request = [data['sl'],data['sw'],data['pl'],data['pw']]
      predict_request = np.array(predict_request)

      # Predict using the random forest model
      y = random_forest_model.predict(predict_request)

      # Return prediction
      output = [y[0]]
      return jsonify(results=output)

      if __name__ == '__main__':
      app.run(port = 9000, debug = True)


      Error Message




      File "C:Anacondalibjsondecoder.py", line 357, in raw_decode
      raise JSONDecodeError("Expecting value", s, err.value) from None



      JSONDecodeError: Expecting value




      is any body try to use Flask web service please help me










      share|improve this question

















      This question already has an answer here:



      • Post JSON using Python Requests

        6 answers



      • How to get POSTed json in Flask?

        5 answers



      I want to deploy a model RandomForestClassifier using Flask.
      I got reference in git hub-https://github.com/a-djebali/flask-machine-learning-resful



      but when I send request to service it will not work instead error given,



      Request.py code below



      import requests
      import json
      import numpy as np



      url = "http://127.0.0.1:9000/predict_api"
      data = json.dumps('sl':5.84,'sw':3.0,'pl':3.75,'pw':1.1)
      r = requests.post(url,data)
      print(r.json())


      for post app.py
      Below Code



      import numpy as np
      from flask import Flask, abort, jsonify, request
      import pickle as pickle

      random_forest_model = pickle.load(open("rfc.pkl","rb"))

      app = Flask(__name__)

      @app.route('/predict_api', methods=['POST'])
      def predict():
      # Error checking
      data = request.get_json(force=True)

      # Convert JSON to numpy array
      predict_request = [data['sl'],data['sw'],data['pl'],data['pw']]
      predict_request = np.array(predict_request)

      # Predict using the random forest model
      y = random_forest_model.predict(predict_request)

      # Return prediction
      output = [y[0]]
      return jsonify(results=output)

      if __name__ == '__main__':
      app.run(port = 9000, debug = True)


      Error Message




      File "C:Anacondalibjsondecoder.py", line 357, in raw_decode
      raise JSONDecodeError("Expecting value", s, err.value) from None



      JSONDecodeError: Expecting value




      is any body try to use Flask web service please help me





      This question already has an answer here:



      • Post JSON using Python Requests

        6 answers



      • How to get POSTed json in Flask?

        5 answers







      python flask






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 at 11:21









      Vadim Kotov

      5,04673550




      5,04673550










      asked Mar 24 at 11:18









      manish vermamanish verma

      41




      41




      marked as duplicate by davidism python
      Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Mar 24 at 14:47


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by davidism python
      Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Mar 24 at 14:47


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
























          0






          active

          oldest

          votes

















          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes

          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript