# mlapp/views.py
from django.http import JsonResponse
def predict(request):
# Load your machine learning model
model = load_model() # Replace with your model loading code
# Get input data from the request
input_data = request.GET.get('data')
# Perform predictions
prediction = model.predict(input_data)
# Return the prediction as JSON response
return JsonResponse({'prediction': prediction})