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
# Remove old version | |
brew uninstall elasticsearch-full | |
rm -rf /usr/local/var/lib/elasticsearch/ | |
rm -rf /usr/local/var/log/elasticsearch/elasticsearch_account.log | |
rm -rf /usr/local/var/elasticsearch/plugins/ | |
rm -rf /usr/local/etc/elasticsearch/ | |
brew uninstall kibana-full | |
rm -rf /usr/local/var/lib/kibana/ | |
rm -rf /usr/local/var/kibana/plugins/ |
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 re, inspect | |
# Taken and modified from https://github.com/fastai/fastcore | |
class Base: | |
def _store_attr(self, **attrs): | |
for n,v in attrs.items(): | |
setattr(self, n, v) | |
self.__stored_args__[n] = v |
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
from googletrans import Translator | |
from google.cloud import translate_v2 as translate | |
from textblob import TextBlob | |
class CustomTranslator: | |
def __init__(self, target='en'): | |
self.target = target | |
self.set_free_client() | |
self.set_google_client() |
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
def fbeta_harmonic_mean(metric1: float, metric2: float, beta: float): | |
""" Return harmonic mean giving more importance to one metric | |
metric1: metric1 value | |
metric2: metric2 value | |
beta : The strength of metric2 versus metric1 in the F-score. | |
""" | |
beta2 = beta ** 2 | |
denom = beta2 * metric1 + metric2 | |
f_score = (1 + beta2) * metric1 * metric2 / denom | |
return f_score |
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
# pip install openai retry | |
import openai | |
from retry import retry | |
model="curie:ft-xxx-2021-01-09-19-21-20 | |
@retry(Exception, tries=3, delay=10) | |
def get_gpt_reason(prompt, model, prob=False, max_tokens=10): | |
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
on: | |
pull_request: | |
types: [opened] | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v5 | |
with: |
OlderNewer