Spaces:
No application file
No application file
| from rest_framework.views import APIView | |
| from django.http import JsonResponse | |
| from TwitterChatBot.main import ask | |
| class AskChatBot(APIView): | |
| """ | |
| let you ask a question to the twitter chatbot | |
| """ | |
| def get(self, request, format=None): | |
| print("working") | |
| question = request.data["question"] | |
| answer = ask(question=question) | |
| return JsonResponse({"answer": answer.strip()}) | |