|
import tensorflow as tf |
|
from flask import Flask, request, jsonify |
|
|
|
app = Flask(__name__) |
|
|
|
|
|
model = tf.keras.models.load_model('Erfan11/Neuracraft') |
|
|
|
@app.route('/predict', methods=['POST']) |
|
def predict(): |
|
data = request.get_json() |
|
|
|
inputs = preprocess_data(data) |
|
|
|
predictions = model.predict(inputs) |
|
|
|
results = postprocess_predictions(predictions) |
|
return jsonify(results) |
|
|
|
def preprocess_data(data): |
|
|
|
pass |
|
|
|
def postprocess_predictions(predictions): |
|
|
|
pass |
|
|
|
if __name__ == '__main__': |
|
app.run(debug=True) |
|
|
|
- **POST /predict**: Receives JSON data, returns model predictions. |