Skip to content

Instantly share code, notes, and snippets.

View Vadbeg's full-sized avatar
🏠

Vadim Titko Vadbeg

🏠
View GitHub Profile
import coremltools as ct
import numpy as np
import torch
from coremltools.models.neural_network import quantization_utils
from PIL import Image
from colorizers import siggraph17, load_img
from colorizers.siggraph17 import ModelHead
@Vadbeg
Vadbeg / send_request.swift
Last active November 5, 2022 12:18
send_request.swift
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
let parameters = [
[
"key": "image",
[tool.black]
line-length = 88
target-version = ["py38"]
[tool.isort]
profile = "black"
multi_line_output = 3
exclude: _pb2\.py$
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: [ --skip-string-normalization ]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
@Vadbeg
Vadbeg / easy_test.js
Created June 10, 2020 19:08
Pass your test without problems (maybe)
variety.viewport.typeset = function(strAddress) {
var driver = variety.viewport.driver;
delete driver.typesetString;
delete driver.typesetScale;
var s = this.recoverStrFromMemory(strAddress);
if(s == "0") s = "10";
driver.typesetString = s.split('\n');
};
1. News Scrapper
GitHub: https://github.com/Vadbeg/NewsScrapper
Description:
Project for reading news from rss files. Includes command line utility and web application.
The main thing about this project is fasts, flexible and easy acces to news in format you want.
You can export every article into fb2, pdf and html.
Languages:
1. Python
Technologies:
1. Django
def add_backgound(image):
"""
Adds background to given image using PIL
"""
image_shape = image.shape
image_height = image_shape[0]
image_width = image_shape[1]
backgound = create_blank_image(image_height,
def create_blank_image(height, width, rgb_color=(0, 0, 255)):
"""
Creates np.array, each channel of which is filled with value from rgb_color
Was stolen from:
:source: https://stackoverflow.com/questions/4337902/how-to-fill-opencv-image-with-one-solid-color
"""
image = np.zeros((height, width, 3), np.uint8)
color = tuple(reversed(rgb_color))
def remove_background(img, threshold):
"""
This method removes background from your image
:param img: cv2 image
:type img: np.array
:param threshold: threshold value for cv2.threshold
:type threshold: float
:return: RGBA image
:rtype: np.ndarray