Skip to content

Instantly share code, notes, and snippets.

View KostaMalsev's full-sized avatar
📱
Building

Kosta Malsev KostaMalsev

📱
Building
View GitHub Profile
//Debounce in js example:
function debounce(func, timeout = 300){
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => { func.apply(this, args); }, timeout);
};
}
function saveInput(){
console.log('Saving data');
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tree Example</title>
<style>
.node {
@KostaMalsev
KostaMalsev / giftCreator1.js
Last active May 16, 2022 09:48
Gif creator jscript part 1
//Set up Image and video uploaders:
window.addEventListener('load', async function() {
//Image loader:
imageUploadButton.addEventListener('change', async function() {
if (videoDownloadLink) videoDownloadLink.remove();
if (this.files && this.files[0]) {
<head>
<title>Create Gif</title>
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<meta charset="utf-8">
<link rel="stylesheet" href="styles.css">
</head>
<body>
//Initate Tesseract model using worker:
//Glob variable OCR worker:
const worker = Tesseract.createWorker({
logger: m => console.log(m)
});
Tesseract.setLogging(true);
async function detectTFMOBILE(imgToPredict) {
//Get next video frame:
//Perform OCR:
if (Analyzef)
{
c.getContext('2d').drawImage(canvas, click_pos.x, click_pos.y,
captureSize.w, captureSize.h, 0, 0, captureSize.w, captureSize.h);
let tempMark = MarkAreaSimple(mouse_pos.x - captureSize.w / 2, mouse_pos.y - captureSize.h / 2, captureSize.w, captureSize.h);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Scatter Chart</title>
<link href="styles.css" rel="stylesheet" />
export default async function handler(request, response) {
const https = require('https');
let query = Object.entries(request.query);
query.shift();
#run detector on test image
#it takes a little longer on the first run and then runs at normal speed.
import random
#Define utility functions for presenting the results:
def load_image_into_numpy_array(path):
"""Load an image from file into a numpy array.
Puts image into numpy array to feed into tensorflow graph.
Note that by convention we put it into a numpy array with shape
(height, width, channels), where channels=3 for RGB.
#Recover our saved model with the latest checkpoint:
pipeline_config = pipeline_file
#Put the last ckpt from training in here, don't use long pathnames:
model_dir = '/content/training/ckpt-2'
configs = config_util.get_configs_from_pipeline_file(pipeline_config)
model_config = configs['model']
detection_model = model_builder.build(
model_config=model_config, is_training=False)
# Restore last checkpoint