0

I am trying to upload an image to then evaluate a machine learning model but the post I receive is empty.

My code

#Basic libraries
import os
from flask import Flask, jsonify, request
from flask_restful import Api, Resource

#Image libraries
import matplotlib.image as mpimg
from skimage import color


app = Flask(__name__)
api = Api(app)


class MakePrediction(Resource):
    @staticmethod
    def post():
        orig_img = request.get_json()
        
        #Here I have to read the image from post or save the image also
        #orig_img=mpimg.imread(orig_img.file)
       
        
        print(orig_img)
        return orig_img
    
api.add_resource(MakePrediction, '/predict')


if __name__ == '__main__':
    app.run(port='8050')

When I try to do a post from postman for example what I am getting is null. Is there a way to make a post, get the file and then process it?

enter image description here

Community
  • 1
  • 1
Henry Navarro
  • 943
  • 8
  • 34

0 Answers0