Skip to content

Instantly share code, notes, and snippets.

View RomanSteinberg's full-sized avatar

Roman Steinberg RomanSteinberg

View GitHub Profile
@RomanSteinberg
RomanSteinberg / test_qt_vs_mx.py
Last active September 6, 2019 12:20
test_qt_vs_mx
import cv2
import sys
import numpy as np
import mxnet as mx
from PyQt5.QtWidgets import QApplication
QApplication(sys.argv) # comment it
@RomanSteinberg
RomanSteinberg / redis_json.py
Created October 16, 2019 14:48
redis json sample code
import redis
import json
data = {
'foo': 'bar',
'd': {'a': 1}
}
r = redis.StrictRedis()
r.execute_command('JSON.SET', 'doc', '.', json.dumps(data))
@RomanSteinberg
RomanSteinberg / train.py
Created November 1, 2019 12:41
Tensorflow 2.0 VAE example
from __future__ import absolute_import, division, print_function, unicode_literals
from tensorflow.keras import layers
try:
# %tensorflow_version only exists in Colab.
%tensorflow_version 2.x
except Exception:
pass
import tensorflow as tf
FROM tensorflow/tensorflow:1.15.0-gpu-py3
RUN addgroup --gid 1001 user && \
adduser --disabled-password --gecos '' -u 1000 --gid 1001 --home /home/user recogniser
WORKDIR /home/user
RUN apt-get update && \
apt-get -y install --no-install-recommends --no-upgrade build-essential cmake \
libopenblas-dev liblapack-dev libx11-dev libgtk-3-dev cuda-toolkit-10-0
@RomanSteinberg
RomanSteinberg / draw
Created May 26, 2020 10:04
stream measurement
import json
from pathlib import Path
import pandas as pd
# from matplotlib.pyplot import plt
from matplotlib import pyplot as plt
%matplotlib inline
with Path('/home/roman/dev/vinteo/backend/measurement.json').open() as f:
m = json.load(f)
CREATE OR REPLACE FUNCTION match_documents(
query_embedding VECTOR(1536),
match_count INT,
metadata_filter JSONB DEFAULT NULL,
similarity_threshold FLOAT DEFAULT 2.0,
target_table TEXT DEFAULT 'message_documents'
)
RETURNS TABLE(id BIGINT, content TEXT, metadata JSONB, similarity FLOAT)
LANGUAGE plpgsql
AS $$