Skip to content

Instantly share code, notes, and snippets.

View uysalserkan's full-sized avatar
🐉
model.predict(privateInput)==25

Serkan UYSAL uysalserkan

🐉
model.predict(privateInput)==25
View GitHub Profile
@uysalserkan
uysalserkan / uysal.zsh-theme
Created September 6, 2022 07:32
Custom and basic zsh theme
# It's created by Serkan UYSAL; github:uysalserkan
# Set up git variables
autoload -Uz vcs_info
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr '%F{red}*'
zstyle ':vcs_info:*' stagedstr '%F{yellow}+'
zstyle ':vcs_info:*' actionformats '%F{5}[%F{2}%b%F{3}|%F{1}%a%c%u%F{5}]%f '
zstyle ':vcs_info:*' formats '%F{5}[%F{2}%b%c%u%F{5}]%f '
zstyle ':vcs_info:svn:*' branchformat '%b'
@uysalserkan
uysalserkan / upload_model_to_elasticsearch.py
Created August 2, 2023 13:15
Upload a hugging face model to Elastic Search Cluster
# Thnaks to SeaseLtd/vector-search-elastic-tutorial
import elasticsearch
from pathlib import Path
from eland.ml.pytorch import PyTorchModel
from eland.ml.pytorch.transformers import TransformerModel
# Elastic configuration.
ELASTIC_ADDRESS = "http://localhost:9200"
# Uncomment the following lines if start ES with SECURITY ENABLED.
#ELASTIC_ADDRESS = "https://localhost:9200"
@uysalserkan
uysalserkan / timeout_decoration.py
Created August 13, 2024 17:21
Timeout decoration with multiprocessing library.
def timeout_decorator(timeout):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
result_queue = multiprocessing.Queue()
def target_func(queue, *args, **kwargs):
try:
result = func(*args, **kwargs)
queue.put(result)
#!/bin/sh
# Check fisrt parameter and run python script with it
if [ "$1" = "ui" ]; then
streamlit run ui.py
elif [ "$1" = "api" ]; then
python3 api.py
else
echo "Invalid run type, please use 'ui' or 'api'."
fi