Skip to content

Instantly share code, notes, and snippets.

View symisc's full-sized avatar

PixLab | Symisc Systems symisc

View GitHub Profile
@symisc
symisc / snapchat_flower_crown_effect.py
Last active August 5, 2017 00:39
Produce the famous Snapchat flower crown effect with the help of the PixLab API (https://pixlab.io/start)
import requests
import json
# Detect all human faces & extract their facial landmarks via `facelandmarks`.
# Once done, mimic the famous Snapchat flower crown filter.
# Only three commands are actually needed in order to mimic the Snapchat filters:
# face landmarks: https://pixlab.io/cmd?id=facelandmarks
# smart resize: https://pixlab.io/cmd?id=smartresize
# merge: https://pixlab.io/cmd?id=merge
# Optionally: blur, grayscale, drawtext, oilpaint, etc. for cool background effects.
@symisc
symisc / snapchat_dog_filter.py
Last active July 26, 2020 11:51
Mimic the two famous Snapchat filters: The flower crown & the dog facial parts with the help of the PixLab (https://pixlab.io) API.
import requests
import json
# Mimic the two famous Snapchat filters: The flower crown & the dog facial parts filter.
# The target image must contain at least one human face. The more faces you got, the more funny it should be!
#
# Only three commands are actually needed in order to mimic the Snapchat filters:
# face landmarks: https://pixlab.io/cmd?id=facelandmarks
# smart resize: https://pixlab.io/cmd?id=smartresize
# merge: https://pixlab.io/cmd?id=merge
@symisc
symisc / snapchat_eye_mask_mustache_meme_filter.py
Last active May 20, 2024 22:36
Make an eye mask plus a mustache Snapchat like filter and finally draw some text on the bottom of the image with the help of the PixLab (https://pixlab.io) API.
import requests
import json
# Make an eye mask plus a mustache filter and finally draw some text on the bottom of the image.
#
# Only three commands are actually needed in order to mimic the Snapchat filters:
# face landmarks: https://pixlab.io/#/cmd?id=facelandmarks
# smart resize: https://pixlab.io/#/cmd?id=smartresize
# merge: https://pixlab.io/#/cmd?id=merge
# rotate (Optionally): https://pixlab.io/#/cmd?id=rotate
<?php
//////////////////////////////////
// Reddit "hot" story algorithm //
//////////////////////////////////
function hot($ups, $downs, $date)
{
if (is_string($date)) $date = strtotime($date);
$s = $ups - $downs;
<?php
/*
* PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github
* https://github.com/symisc/pixlab-php
*/
require_once "pixlab.php";
# Target Image: Change to any link (Possibly adult) you want or switch to POST if you want to upload your image directly, refer to the sample set for more info.
$img = 'https://i.redd.it/oetdn9wc13by.jpg';
# Your PixLab key
@symisc
symisc / bin2c.c
Created August 26, 2017 13:43 — forked from albertz/bin2c.c
bin2c
#include <stdio.h>
#include <assert.h>
int main(int argc, char** argv) {
assert(argc == 2);
char* fn = argv[1];
FILE* f = fopen(fn, "r");
printf("char a[] = {\n");
unsigned long n = 0;
while(!feof(f)) {
@symisc
symisc / optical_character_recognition.php
Created October 3, 2017 01:19
Given an input image with human readable characters. Detect input language & extract text content from there using PixLab OCR (https://pixlab.io/cmd?id=ocr)
<?php
/*
* PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github
* https://github.com/symisc/pixlab-php
*/
require_once "pixlab.php";
# Given an image with human readable characters. Detect input language & extract text content from there.
# https://pixlab.io/#/cmd?id=ocr for additional information.
@symisc
symisc / image_colorization.py
Created October 23, 2017 04:01
Grayscale image colorization using deep learning models via the PixLab /colorize API endpoint. https://pixlab.io/cmd?id=colorize
import requests
import json
# Colorize this 1933 picture of this little girl via: https://pixlab.io/cmd?id=colorize
req = requests.get('https://api.pixlab.io/colorize',params={'img':'https://i.redd.it/7z1q27vaa9tz.png','key':'My_PixLab_Key'})
reply = req.json()
if reply['status'] != 200:
print (reply['error'])
else:
print ("Link to the colorized picture: "+ reply['link'])
@symisc
symisc / sod_cnn_intro.c
Last active August 5, 2020 21:55
A simple C program that demonstrate how to use the SOD CNN interfaces to detect multiple objects on a given input image or video frame. https://sod.pixlab.io
/*
* Programming introduction with the SOD Embedded Convolutional/Recurrent Neural Networks (CNN/RNN) API.
* Copyright (C) PixLab | Symisc Systems, https://sod.pixlab.io
*/
/*
* Compile this file together with the SOD embedded source code to generate
* the executable. For example:
*
* gcc sod.c cnn_object_detection.c -lm -Ofast -march=native -Wall -std=c99 -o sod_cnn_intro
*
@symisc
symisc / sod_realnet_train_model.c
Last active March 20, 2018 01:35
Train a Realnet Model on your CPU using the SOD Embedded API - https://sod.pixlab.io
/*
* Programming introduction with the SOD Embedded RealNets Model Training API.
* Training must be enabled via the compile-time directive SOD_ENABLE_NET_TRAIN.
*
* Copyright (C) PixLab | Symisc Systems, https://sod.pixlab.io
*/
/*
* Compile this file together with the SOD embedded source code to generate
* the executable. For example:
*