In this section, we'll first set the required route, the view, and the imports for the CNTK model to work with Django. We will then load the CNTK model from the saved file and make predictions using it.
Making predictions using CNTK from the Django project
Setting up the predict route and view
Recall how we created the / route and its corresponding view in the api app:
- First, add the following line to mysite/api/urls.py:
urlpatterns = [
path('', views.indexView),
path('predict', views.predictView), # -- Add this line!
]
This creates the /predict route. However, the view, predictView, is not yet created.
- Add the following lines to the views.py file in the api app:
from django.http import JsonResponse...