Show HN: I've trained my neural network to play Tinder

10 points by atum47 ↗ HN
The video is here: https://www.youtube.com/watch?v=Ohs6sgmVNYI

This video is a prof of concept. I always wanted to see if I could make my Neural Network play tinder for me. So I gather some pictures, created a fake tinder app (so I don't expose real people) and began the training.

For this experiment I'm using scrcpy to control my cellphone and pyautogui alongside my neural network. The script is very simple:

Get the image, run it trough a neural network, move the mouse to the output (yes or no) and click.

There's a lot of hard coded things in my code, but as I said earlier, it is just a prof of concept.

The code is pretty much garbage, but here's it if anyone care to look:

import json

from PIL import Image, ImageChops

import numpy as np

from Dejavu import Dejavu #this is my neural network (soon on GitHub)

import pyautogui

import time

data = json.loads( open('nn.json','r').read() )

nn = Dejavu()

nn.load(data)

choices = { 0: (900,565), 1: (1055,565) }

pyautogui.moveTo(850, 210) pyautogui.click()

        # I know there's only 6 pictures on my fake tinder app
 for i in range(7):

  img = pyautogui.screenshot().convert('L')

  img = img.crop( (810,210, 1150, 500) )

  img.thumbnail( (36,36) )

  arr = np.array(img).reshape(-1)

  arr = np.pad(arr, (0,36*36-arr.shape[0]), mode='constant')

  result =  nn.predict( arr.tolist() )[0].tolist()

  result = result.index( max(result) ) 

  pyautogui.moveTo( choices[result] )

  pyautogui.click()
 
  if i < 6:
   time.sleep(3)

5 comments

[ 6.1 ms ] story [ 27.2 ms ] thread
friendly reminder that my script would work with pictures of guys too, in case any girl wanted.

you just have to create two folders: one with pictures of people that you consider attractive and one with pictures of people you don't