File size: 383 Bytes
547b48b
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from flask import Blueprint, request, jsonify
from .model import predict

api = Blueprint('api', __name__)

@api.route('/predict', methods=['POST'])
def predict_route():
    data = request.get_json()
    if not data or 'input' not in data:
        return jsonify({'error': 'Invalid input'}), 400
    prediction = predict(data['input'])
    return jsonify({'prediction': prediction})