Skip to content

Instantly share code, notes, and snippets.

View joelbarmettlerUZH's full-sized avatar
💭
Growing strong 🚀

Joel Barmettler joelbarmettlerUZH

💭
Growing strong 🚀
View GitHub Profile
{
"meta": {
"status": 200
},
"data": {
"results": [
{
"type": "user",
"user": {
"_id": "4adfwe547s8df64df",
@joelbarmettlerUZH
joelbarmettlerUZH / auto_tinder.py
Created October 5, 2019 09:08
Tinder Person class
import datetime
from geopy.geocoders import Nominatim
TINDER_URL = "https://api.gotinder.com"
geolocator = Nominatim(user_agent="auto-tinder")
PROF_FILE = "./images/unclassified/profiles.txt"
class Person(object):
def __init__(self, data, api):
@joelbarmettlerUZH
joelbarmettlerUZH / auto_tinder.py
Created October 5, 2019 09:10
Tinder API Wrapper
import requests
TINDER_URL = "https://api.gotinder.com"
class tinderAPI():
def __init__(self, token):
self._token = token
def profile(self):
if __name__ == "__main__":
token = "YOUR-API-TOKEN"
api = tinderAPI(token)
while True:
persons = api.nearby_persons()
for person in persons:
print(person)
# person.like()
@joelbarmettlerUZH
joelbarmettlerUZH / auto-tinder.py
Created October 5, 2019 09:11
Download Images of Tinder Accounds
# At the top of auto_tinder.py
PROF_FILE = "./images/unclassified/profiles.txt"
# inside the Person-class
def download_images(self, folder=".", sleep_max_for=0):
with open(PROF_FILE, "r") as f:
lines = f.readlines()
if self.id in lines:
return
with open(PROF_FILE, "a") as f:
@joelbarmettlerUZH
joelbarmettlerUZH / main.py
Created October 5, 2019 09:11
Loop over nearby profiles and download all images
if __name__ == "__main__":
token = "YOUR-API-TOKEN"
api = tinderAPI(token)
while True:
persons = api.nearby_persons()
for person in persons:
person.download_images(folder="./images/unclassified", sleep_max_for=random()*3)
sleep(random()*10)
sleep(random()*10)
@joelbarmettlerUZH
joelbarmettlerUZH / image_classifier.py
Created October 5, 2019 09:12
Tkinter Image classification GUI
from os import listdir, rename
from os.path import isfile, join
import tkinter as tk
from PIL import ImageTk, Image
IMAGE_FOLDER = "./images/unclassified"
images = [f for f in listdir(IMAGE_FOLDER) if isfile(join(IMAGE_FOLDER, f))]
unclassified_images = filter(lambda image: not (image.startswith("0_") or image.startswith("1_")), images)
current = None
@joelbarmettlerUZH
joelbarmettlerUZH / person_detector.py
Last active October 5, 2019 09:14
Load tensorflow graph
import tensorflow as tf
def open_graph():
detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.GraphDef()
with tf.gfile.GFile('ssd_mobilenet_v1_coco_2017_11_17/frozen_inference_graph.pb', 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name='')
@joelbarmettlerUZH
joelbarmettlerUZH / person_detector.py
Created October 5, 2019 09:13
Load image as numpy array
import numpy as np
def load_image_into_numpy_array(image):
(im_width, im_height) = image.size
return np.array(image.getdata()).reshape(
(im_height, im_width, 3)).astype(np.uint8)
@joelbarmettlerUZH
joelbarmettlerUZH / person_detector.py
Created October 5, 2019 09:15
Call tensorflow object detection API
import numpy as np
from object_detection.utils import ops as utils_ops
import tensorflow as tf
def run_inference_for_single_image(image, sess):
ops = tf.get_default_graph().get_operations()
all_tensor_names = {output.name for op in ops for output in op.outputs}
tensor_dict = {}
for key in [
'num_detections', 'detection_boxes', 'detection_scores',