This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
from pathlib import Path | |
from pillow_heif import register_heif_opener | |
from tqdm import tqdm | |
from argparse import ArgumentParser | |
register_heif_opener() | |
def main(params): | |
print("Converting HEIC files to JPG") | |
files = list(Path(".").glob("*.heic")) + list(Path(".").glob("*.HEIC")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openai | |
from decouple import config | |
openai.api_key = config("OPENAI_KEY") | |
YES_TOKEN = frozenset([5297, 3763, 3363, 8505, 3363, 3763, 43335, 3763, 21560]) | |
NO_TOKEN = frozenset([2949, 645, 1400, 3919, 1400, 645, 15285, 645, 8005]) | |
def yes_or_no(txt: str)->bool: | |
response = openai.Completion.create( | |
model="text-davinci-003", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wsl --shutdown | |
diskpart | |
# open window Diskpart | |
select vdisk file="C:\Users\ugore\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx" | |
attach vdisk readonly | |
compact vdisk | |
detach vdisk | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
from itertools import product | |
from scipy import sparse | |
from sklearn.base import TransformerMixin | |
class InteractionBySplit(TransformerMixin): | |
""" | |
Takes a sparse matrix as input, and an index to split by, and returns all possible interactions before and after that index. | |
""" | |
def __init__(self, split_index,*args,**kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import subprocess, sys | |
def bgprocess(p:Path, *args): | |
python = sys.executable | |
if not isinstance(p, Path): | |
p = Path(p) | |
p = p.absolute() | |
return subprocess.Popen([python, p.name]+list(args), cwd = str(p.parent), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy as clone | |
from sklearn.base import ClassifierMixin | |
from sklearn.pipeline import Pipeline | |
class ConditionedTextClassifier(ClassifierMixin): | |
def __init__(self, conditions, model, condition_sep=' <s> '): | |
self.condition_sep=condition_sep | |
self.conditions = {} | |
for c in conditions: | |
self.conditions[c] = clone(model) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys, json | |
from pathlib import Path | |
class ConfigReader: | |
def __init__(self, default=None, **kwargs): | |
self.default=default | |
self.py_file = Path(os.path.join(os.getcwd(), sys.argv[0])).absolute() | |
p = self.py_file.parent | |
found_config_json = [] | |
while p!=Path('/'): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options +SymLinksIfOwnerMatch | |
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^((?!index\.php).+)$ /index.php?py=$1 [NC,L,QSA] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os | |
import streamlit as st | |
def file2page_name(fname): | |
return fname.replace('.py', '').split("_", 1)[1].title() | |
sys.path.append("..") | |
page_files = dict() |
NewerOlder