Skip to content

Instantly share code, notes, and snippets.

@AlexDel
AlexDel / repo.py
Last active October 23, 2022 04:50
class ClassifierRepository:
def __init__():
self.queue_length = queue_length
self.s3_client = minio.Minio(
endpoint=endpoint,
access_key=access_key,
secret_key=secret_key
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.frame=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src="https://storage.yandexcloud.net/frame/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="frame",u.people=u.people||[],u.toString=function(t){var e="frame";return"frame"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.frame||[]);
frame.init('7YHFWofuukjLt99nddm_tdtD3ci8V3VCo7BUP7wbdNw',{api_host:'https://f
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({
Attaching to fmcg-cv-solution-backend
fmcg-cv-solution-backend | /usr/local/lib/python3.8/site-packages/torchvision/transforms/transforms.py:256: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
fmcg-cv-solution-backend | warnings.warn("The use of the transforms.Scale transform is deprecated, " +
fmcg-cv-solution-backend | Traceback (most recent call last):
fmcg-cv-solution-backend | File "main.py", line 17, in <module>
fmcg-cv-solution-backend | uvicorn.run(
fmcg-cv-solution-backend | File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 359, in run
fmcg-cv-solution-backend | config = Config(app, **kwargs)
fmcg-cv-solution-backend | File "/usr/local/lib/python3.8/site-packages/uvicorn/config.py", line 191, in __init__
fmcg-cv-solution-backend | self.configure_logging()
@AlexDel
AlexDel / some_delay.py
Created July 29, 2020 10:36
How to make concurent delya with rx.py
!pip install rx
import time
import rx
from rx import operators as ops
PLEASE_WAIT_TIMEOUT = 2
SEARCH_TIMEOUT = 3
def utter_bot():
@AlexDel
AlexDel / rubert.py
Last active June 16, 2020 10:16
RuBERT
from transformers import AutoModelWithLMHead, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("DeepPavlov/rubert-base-cased-conversational")
model = AutoModelWithLMHead.from_pretrained("DeepPavlov/rubert-base-cased-conversational")
tokens = tokenizer.tokenize('Привет, друг!')
input_ids = torch.tensor(tokenizer.encode(tokens, add_special_tokens=True)).unsqueeze(0) # Batch size 1
outputs = model(input_ids)
@AlexDel
AlexDel / docker-compose.yml
Created May 15, 2020 07:58
Docker compose config
version: '2'
services:
db:
restart: always
image: postgres:10
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
from mypy_extensions import TypedDict
from typing import List
class RegionAnnotation(TypedDict):
x: int
y: int
height: int
width: int
name: str
FROM nvidia/cuda:9.1-runtime-ubuntu16.04
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update
RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv
RUN apt-get install -y git
def calc_tokens_feature(targetTokens=[]):
def calc_tokens_ratio(textTokens=[]):
counter = 0
if len(textTokens) == 0:
return 0
for token in textTokens:
if token in targetTokens:
counter +=1