Last active
April 16, 2019 10:07
-
-
Save yerkbn/b6b51ca099d4d72e6e59c1aade47b79b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework.response import Response | |
from rest_framework.decorators import api_view, permission_classes | |
from rest_framework.permissions import AllowAny | |
from rest_framework.status import ( | |
HTTP_200_OK, | |
HTTP_400_BAD_REQUEST, | |
) | |
from .classification_research.CNN import CNN | |
CNN_obj = CNN() | |
@api_view(['POST']) | |
@permission_classes((AllowAny,)) | |
def classify(request): | |
try: | |
file = request.data['file'] | |
except KeyError: | |
return Response({'file': ['no file']}, status=HTTP_400_BAD_REQUEST) | |
result = CNN_obj.prediction(file) | |
return Response(result, status=HTTP_200_OK) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment