def testclasstoemotion(self): """ Ensure classtoemotion function is converting int to labels properly """ self.assertEqual(Predict.classtoemotion(0), "neutral") self.assertEqual(Predict.classtoemotion(1), "calm") self.assertEqual(Predict.classtoemotion(2), "happy") self.assertEqual(Predict.classtoemotion(3), "sad") self.assertEqual(Predict.classtoemotion(4), "angry") self.assertEqual(Predict.classtoemotion(5), "fearful") self.assertEqual(Predict.classtoemotion(6), "disgust") self.assertEqual(Predict.classtoemotion(7), "surprised")
""" Urls.py includes the url configurations of the application. """ from django.conf.urls import url from App.views import Predict from App.views import FileView from App.views import FileDeleteView app_name = 'App' urlpatterns = [ url(r'^predict/$', Predict.as_view(), name='APIpredict'), url(r'^upload/$', FileView.as_view(), name='APIupload'), url(r'^delete/$', FileDeleteView.as_view(), name='APIdelete'), ]
from App.views import Train, Predict from django.conf.urls import url app_name = 'App' urlpatterns = [ url(r'^train/$', Train.as_view(), name="train"), url(r'^predict/$', Predict.as_view(), name="predict"), ]
#access url from App.views import Train, Predict from django.conf.urls import url app_name = 'App' urlpatterns = [ url('.\modelsML', Predict.as_view(), name="lineapi()", id=1), url('.\modelsML', Predict.as_view(), name="cvapi()", id=2), url('.\modelsML', Predict.as_view(), name="dtapi()", id=3), url('.\modelsML', Predict.as_view(), name="mlpapi", id=4), url('.\modelsML', Predict.as_view(), name="rfapi", id=5), url('.\modelsML', Predict.as_view(), name="elastapi()", id=6) ]
from App.views import Train, Predict from django.urls import path app_name = 'App' urlpatterns = [ path('train/', Train.as_view(), name="train"), path('predict/', Predict.as_view(), name="predict"), ]