Tuesday, 9 July 2019

Python Azure Apps 404 in paths

I followed this Create a Python app in Azure App Service on Linux and uploaded my code with the folowing functions:

@app.route('/predict_json', methods=['POST'])
def add_message():
    content = request.json

    tweets = pd.DataFrame(content)
    tweets["polarity"] = pipeline.predict(tweets.Tweet)   

    return tweets.to_json()

@app.route('/predict')
def predict():
    # Retrieve query parameters related to this request.
    content = request.args.get('content')    

    d = {'tweet': [content]}
    df = pd.DataFrame(data=d)

    # Use the model to predict the class
    label_index = pipeline.predict(df.tweet)
    # Retrieve the iris name that is associated with the predicted class
    label = MODEL_LABELS[label_index[0]]
    label_int = MODEL_INT[label_index[0]]
    # Create and send a response to the API caller
    return jsonify(status='complete',tweet=content, polarity=label_int, polarity_text=label)

In local they work perfect. But when deployed I got 404.

My code is here https://github.com/mulflar/saturdayAi/blob/master/twitteranalisisdesentimientosnlp.py



from Python Azure Apps 404 in paths

No comments:

Post a Comment