コード例 #1
0
def get_gender():
    """
    This API returns the predicted gender of all faces detected in an image.
    Call this api passing a coloured image.
    ---
    tags:
      - Image Analyzer
    consumes:
      - multipart/form-data
    produces: 
      -application/json
    parameters:
      - in: formData
        name: upfile
        type: file
        required: true
        description: Upload your file
    responses:
      500:
        description: Error, something went wrong!
      200:
        description: Detection success!
    """
    response = None
    iFile = request.files.getlist('upfile')[0]
    img = load_image(iFile)
    img = rotate_image(img, iFile)
    img = limit_size_image(img)
    model = Gender(img)
    response = model.get_prediction()
    return jsonify(response)
コード例 #2
0
def lambda_handler(event, context):
    if 'body' in event:
        item = json.loads(event.pop('body', event))
    else:
        item = event
    dto = Gender(item)
    ret_val = dto.update()
    response = {'statusCode': 200, 'body': json.dumps({'result': ret_val})}
    return response
コード例 #3
0
def lambda_handler(event, context):
    if 'queryStringParameters' in event:
        item = event.pop('queryStringParameters')
        if isinstance(item, str):
            item = literal_eval(item)
    else:
        item = event
    dto = Gender(item)
    ret_val = dto.delete()
    response = {'statusCode': 200, 'body': json.dumps({'result': ret_val})}
    return response
コード例 #4
0
def lambda_handler(event, context):
    if 'queryStringParameters' in event:
        item = event.pop('queryStringParameters')
        if isinstance(item, str):
            item = literal_eval(item)
    else:
        item = event
    dto = Gender(item)
    return_item = dto.read()

    response = {
        'statusCode': 200,
        "body": json.dumps(return_item),
    }
    return response
コード例 #5
0
    def scrap_profiles(self):
        instadir = open("instarank.csv", "w")
        output = csv.writer(instadir, delimiter=',')

        profiles = []
        while (True):
            time.sleep(1)

            profileName = self.get_post_profName()
            profileLocation = self.get_post_location()
            postTime = self.get_post_time()
            likes = self.get_post_likes()
            imageAlt = self.get_image_alt()
            tgender = Gender(profileName)

            print(profileName + ' @ ' + profileLocation + '  ' +
                  str(postTime) + ' ' + str(likes) + " " + str(tgender))
            if (tgender == "null" or tgender == "female"):
                tprofile = [
                    profileName, profileLocation, postTime, imageAlt, likes,
                    tgender
                ]
                self.writeToCsv(tprofile, output)
                print("t scraped")

            time.sleep(1)
            try:
                self.go_to_next()
            except Exception as e:
                print('No next')
コード例 #6
0
ファイル: utils.py プロジェクト: DiaaZiada/ClearFace
def load_models(path):
    global gender, expression, multiple, face_detection, landmarks2d, landmarks3d
    gender = Gender(os.path.join(path, "gender.zip"))
    expression = Expression(os.path.join(path, "expression.zip"))
    multiple = Multiple(os.path.join(path, "multiple"))
    face_detection = FaceDetection(os.path.join(path, "face_detection"))
    landmarks2d = LandMarks2D(path)
    landmarks3d = LandMarks3D(path)
コード例 #7
0
ファイル: app.py プロジェクト: weyj4/NLTK-Sandbox
def gender():
    name = request.form['name']
    test = Gender(name)
    answer = test.run()
    print answer
    return render_template('gender.html', data=answer)