Domeandreimno's picture
Upload 3 files
5977409 verified
raw
history blame contribute delete
382 Bytes
from ultralytics import YOLO
from flask import Flask, request, jsonify
app = Flask(__name__)
model = YOLO('best.pt')
@app.route('/predict', methods=['POST'])
def predict():
image = request.files['file'].read()
results = model(image)
return jsonify(results.pandas().xyxy[0].to_json(orient="records"))
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)