From 7e9f4828e9743e7c96291b772ce9f5c132e1e244 Mon Sep 17 00:00:00 2001 From: pymit Date: Tue, 2 Jul 2019 09:21:01 +0530 Subject: [PATCH] main api Docstring --- coreapi/main_api.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/coreapi/main_api.py b/coreapi/main_api.py index ebb3429..4e75ab2 100644 --- a/coreapi/main_api.py +++ b/coreapi/main_api.py @@ -16,6 +16,15 @@ def FaceRecogniseInImage(request, filename): + """Face Recognition in image + + Args: + request: Post https request containing a image file + filename: filename of the video + + Returns: + Dictionary having all the faces and corresponding bounding boxes + """ file_path = os.path.join(MEDIA_ROOT, 'images/' + filename) handle_uploaded_file(request.FILES['file'], file_path) file = request.FILES['file'] @@ -61,6 +70,15 @@ def FaceRecogniseInImage(request, filename): def FaceRecogniseInVideo(request, filename): + """Face Recognition in Video + + Args: + request: Post https request containing a video file + filename: filename of the video + + Returns: + Dictionary having all the faces and corresponding time durations + """ file_path = os.path.join(MEDIA_ROOT, 'videos/' + filename) handle_uploaded_file(request.FILES['file'], file_path) try: @@ -134,6 +152,16 @@ def FaceRecogniseInVideo(request, filename): def createEmbedding(request, filename): + """ + To create embeddings of face + + Args: + request: Post https request containing a image file + filename: filename of the video + + Returns: + success flag + """ file = request.FILES['file'] if file and allowed_file(filename=filename, allowed_set=allowed_set): filename = secure_filename(filename=filename).replace('_', ' ').split('.')[0].title() @@ -167,6 +195,16 @@ def createEmbedding(request, filename): def stream_video_download(url, filename): + """ + to download a youtube video + + Args: + url: url of the youtube video + filename: filename of the video + + Returns: + Nothing + """ output_dir = "{}/{}/".format(MEDIA_ROOT, 'videos') command = "youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' \"{}\" -o {}.mp4".format(url, filename) try: