Skip to content

Commit

Permalink
Merge pull request #24 from pymit/Documentation
Browse files Browse the repository at this point in the history
Docstrings for main_api
  • Loading branch information
marxmit7 committed Jul 19, 2019
2 parents a078732 + 7e9f482 commit 7f250b7
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions coreapi/main_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 7f250b7

Please sign in to comment.