I was wondering on how do you upload files by creating an API service?
class UploadImage(Resource):
def post(self, fname):
file = request.files[\
class UploadWavAPI(Resource):
def post(self):
parse = reqparse.RequestParser()
parse.add_argument('audio', type=werkzeug.FileStorage, location='files')
args = parse.parse_args()
stream = args['audio'].stream
wav_file = wave.open(stream, 'rb')
signal = wav_file.readframes(-1)
signal = np.fromstring(signal, 'Int16')
fs = wav_file.getframerate()
wav_file.close()
You should process the stream, if it was a wav, the code above works. For an image, you should store on the database or upload to AWS S3 or Google Storage