Created
June 20, 2019 17:31
-
-
Save kaustumbh7/8be040e5c57b62fd50c4c94b4e643e35 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 django.shortcuts import render | |
from .apps import WebappConfig | |
# Create your views here. | |
from django.http import HttpResponse, JsonResponse | |
from django.shortcuts import get_object_or_404 | |
from rest_framework.views import APIView | |
from rest_framework.response import Response | |
from rest_framework import status | |
from .apps import WebappConfig | |
class call_model(APIView): | |
def get(self,request): | |
if request.method == 'GET': | |
# sentence is the query we want to get the prediction for | |
params = request.GET.get('sentence') | |
# predict method used to get the prediction | |
response = WebappConfig.predictor.predict(sentence) | |
# returning JSON response | |
return JsonResponse(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment