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.llms import Ollama | |
from langchain.document_loaders import WebBaseLoader | |
from langchain.text_splitter import RecursiveCharacterTextSplitter | |
from langchain.embeddings import GPT4AllEmbeddings | |
from langchain.vectorstores import Chroma | |
from langchain.chains import RetrievalQA | |
import gradio as gr | |
# Initialize variables to store the previous URL and its corresponding data and embeddings | |
prev_url = None |
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
#!/bin/bash | |
# Replace YOUR_API_KEY with your actual API key | |
API_KEY="OPEN_AI_API_KEY" | |
# Clear the screen | |
clear | |
# Function to check if the API key is set | |
check_api_key() { |
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 requests | |
from bs4 import BeautifulSoup | |
from urllib.parse import urlparse, urljoin | |
def create_sitemap(url): | |
# Parse the base URL | |
parsed_url = urlparse(url) | |
base_url = parsed_url.scheme + "://" + parsed_url.netloc | |
# Initialize the set of visited URLs |
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
#!/bin/bash | |
# Replace YOUR_API_KEY with your actual API key | |
API_KEY="OPEN_AI_API_KEY" | |
# Get the message from the command line argument | |
MESSAGE=$1 | |
# Set up the API endpoint | |
API_ENDPOINT="https://api.openai.com/v1/chat/completions" |
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
/* | |
Hamming distance is a measure of the difference between | |
two same-length strings of characters. Simply put, it is | |
defined as the number of positions at which corresponding | |
characters in two strings of characters are different. | |
Formally, the Hamming distance between two same-length | |
strings of characters, s and t, is defined as the number | |
of positions at which the corresponding characters are |
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 datetime import datetime, timedelta | |
import math | |
def calculate_biorhythm(birthday, current_date, rhythm_type): | |
days_difference = (current_date - birthday).days | |
if rhythm_type == 'physical': | |
cycle = 23 | |
elif rhythm_type == 'emotional': |
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 json | |
import snscrape | |
import snscrape.modules.twitter as sntwitter | |
import snscrape.modules.facebook as snfacebbok | |
import snscrape.modules.instagram as sninstagram | |
import snscrape.modules.mastodon as snmastodon | |
import snscrape.modules.reddit as smreddit | |
def lambda_handler(event, context): | |
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
Id | SepalLengthCm | SepalWidthCm | PetalLengthCm | PetalWidthCm | Species | |
---|---|---|---|---|---|---|
1 | 5.1 | 3.5 | 1.4 | 0.2 | Iris-setosa | |
2 | 4.9 | 3.0 | 1.4 | 0.2 | Iris-setosa | |
3 | 4.7 | 3.2 | 1.3 | 0.2 | Iris-setosa | |
4 | 4.6 | 3.1 | 1.5 | 0.2 | Iris-setosa | |
5 | 5.0 | 3.6 | 1.4 | 0.2 | Iris-setosa | |
6 | 5.4 | 3.9 | 1.7 | 0.4 | Iris-setosa | |
7 | 4.6 | 3.4 | 1.4 | 0.3 | Iris-setosa | |
8 | 5.0 | 3.4 | 1.5 | 0.2 | Iris-setosa | |
9 | 4.4 | 2.9 | 1.4 | 0.2 | Iris-setosa |
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 torch | |
# pip install "transformers==4.24.0" | |
# usage: python text-generator-transformers.py 'some text' | |
import sys | |
import torch | |
from transformers import GPT2Tokenizer, GPT2LMHeadModel | |
arg = sys.argv |
NewerOlder