19 lines
472 B
Python
19 lines
472 B
Python
|
from flask import Flask, request, jsonify
|
||
|
from PIL import Image
|
||
|
import datetime
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
@app.route("/post_img", methods=["POST"])
|
||
|
def process_image():
|
||
|
file = request.files['image']
|
||
|
# Read the image via file.stream
|
||
|
img = Image.open(file.stream)
|
||
|
time = str(datetime.datetime.now().isoformat(timespec='minutes'))
|
||
|
img.save("./images/"+time+".png")
|
||
|
|
||
|
return jsonify({'msg': 'success'})
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
app.run(debug=True)
|