Python know almost find the most handsome of the most beautiful people! I'm the most handsome of the ah ~

 

Some say almost Crouching Tiger, there Nvwang Empress Dowager, flowers and the moon looks, male friends have jade tree, handsome gesture, today we'll explore some now!

Reptile section

I chose a very high heat almost 10 questions, men and women both. Shuai Shuai tragic is to what extent?  ", Questions such as the Yen would be like God does, really looking forward to it.

Here crawling each of these questions answered before one hundred (after all, rarely high praise answer after page one hundred) all in the picture, after all, these problems are a picture is worth a thousand words the classic problem. Reptile logic is very simple, all the jpg image link under each answer to each question, png format into Redis, the list of parameters can only copy on the page, only change required is offset, it is with us page offset control parameters (5 per increment).

def get_urls(self,offset,urls):
        
        params={
                'include': '',  
                'limit': 5,
                'offset': offset,
                'platform': 'desktop',
                'sort_by': 'default'              
                }
        r=requests.get(self.url,headers=self.headers,params=params)
        data=r.json()['data']
        for i in data:
            content=i['content']
            pic_urls=re.findall(r'data-actualsrc="(.*?.(jpg|png))',content)
            for j in range(len(pic_urls)):
                self.r.sadd("urls",pic_urls[j][0])

Yen value ratings

Yan score value of part of it, I called Kuang depending on the API, the direct use of images can generate json url link data contains color value score, and this score is the percentage system.

data={
            'api_key':'',
            'api_secret':'',                         
            'return_attributes': 'beauty,gender',
            'image_url': image_url
              }
r=requests.post(url=self.url,headers=self.headers,data=data)
score_data=json.loads(r.text)
if len(score_data['faces'])==0:
    print("未从该图片中找到人像!")
else:
    face_num=score_data['face_num']
    for i in range(face_num):
        face=score_data['faces'][i]
        beauty=face['attributes']['beauty']
        gender=face['attributes']['gender']
        if gender['value']=='Female':
            score=beauty['female_score']
        else:
            score=beauty['male_score']
        item={'image_url':image_url,
                     'score':score
                                 }
        self.db['score2'].insert_one(item)

api_key and api_secret is required to apply, I put all the pictures have been corresponding by API score, and stored in MongoDB, the picture under a different issue ratings stored in different tables.

All pictures average score is 69.66 Yen value, probably the whole "  good  " grade, is probably the AI score is too strict, then look at those scoring more than 91 girls, what a beautiful landscape, the way guess guess which one is the highest score 94.396?

The following pressure boys came here, what "brutal" more handsome?

Ah, really, really beautiful, really handsome. After you've finished listening hotties, presumably to give themselves a face value score is the basic operation, right? After all, I'm the face value and the average score more than 85 points Daniel Wu Man!

Oh source project plus group: 850 591 259

 

Guess you like

Origin www.cnblogs.com/Py1233/p/12626000.html