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 trafaret as t | |
class DecisionLog: | |
def __init__(self, reason_key=''): | |
self.init() | |
self._reason_key = reason_key | |
self._len_reason_key = len(reason_key) | |
def init(self): | |
self.logs = [] |
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 deeplake.util.bugout_reporter import deeplake_reporter | |
from deeplake.client.client import DeepLakeBackendClient | |
def list_deeplake_datasets( | |
org_id: str = "", | |
token: str = None, | |
) -> None: | |
"""List all available Deep Lake cloud datasets. | |
Removed from deeplake in: https://github.com/activeloopai/deeplake/pull/2182/files | |
""" |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Python: Streamlit", | |
"type": "python", | |
"request": "launch", | |
"module": "streamlit", | |
"env": { | |
// any .env variables you may have |
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 numpy as np | |
import pandas as pd | |
import asyncio | |
import openai | |
from sentence_transformers import SentenceTransformer | |
openai.api_key = "YOUR-API-KEY" | |
model = SentenceTransformer('all-MiniLM-L6-v2') |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Python: Current File", | |
"type": "python", | |
"request": "launch", | |
"program": "${file}", | |
"console": "integratedTerminal", | |
"cwd": "${fileDirname}", |
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 langchain_chroma import Chroma | |
from langchain_openai import OpenAIEmbeddings | |
from langchain_community.document_loaders import PDFMinerLoader, PyMuPDFLoader | |
from langchain_text_splitters import RecursiveCharacterTextSplitter | |
pdf_path = "https://www.barclaycard.co.uk/content/dam/barclaycard/documents/personal/existing-customers/terms-and-conditions-barclaycard-core-2019.pdf" | |
loader = PDFMinerLoader(pdf_path) # loads all text into a single document | |
loader = PyMuPDFLoader(pdf_path) # loads each page as a separate document | |
documents = loader.load() |
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 numpy as np | |
import matplotlib.pyplot as plt | |
# Constants | |
G = 6.67430e-11 # gravitational constant | |
def compute_accelerations(positions, masses): | |
num_bodies = len(masses) | |
accelerations = np.zeros_like(positions) | |
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 argparse | |
def convert_to_utf8(path, input_encoding): | |
path = Path(path) | |
if path.is_file(): | |
files = [path] | |
elif path.is_dir(): | |
files = path.glob('*') | |
else: |