Skip to content

Instantly share code, notes, and snippets.

View svpino's full-sized avatar
🏠
Working from home

Santiago Valdarrama svpino

🏠
Working from home
View GitHub Profile
@svpino
svpino / llamaindex-sample.py
Created August 30, 2023 14:49
Using LlamaIndex to ask question about your data
# !pip install llama-index monsterapi sentence_transformers --quiet
import os
from llama_index.llms import MonsterLLM
from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext
from llama_index.embeddings import LangchainEmbedding
from langchain.embeddings import HuggingFaceEmbeddings
from sentence_transformers import SentenceTransformer
@svpino
svpino / llama2.py
Last active January 25, 2024 13:12
Running a fine-tuned Llama 2 model
import torch
import peft
import transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
from huggingface_hub.hf_api import HfFolder
ACCESS_TOKEN = "ENTER YOUR HUGGINGFACE ACCESS TOKEN HERE"
HfFolder.save_token(ACCESS_TOKEN)
@svpino
svpino / pycaret_sample.py
Last active August 17, 2023 17:38
PyCaret Sample
import comet_ml
from pycaret.datasets import get_data
from pycaret.classification import *
comet_ml.init(project_name="pycaret")
dataset = get_data("titanic")
clf1 = setup(
data=dataset,
import os
import assemblyai as aai
from pytube import YouTube
aai.settings.api_key = "INSERT YOUR API KEY HERE"
youtube_url = "https://www.youtube.com/watch?v=f94wKh70cOY"
# Let's download the YouTube video
youtube = YouTube(youtube_url)
audio = youtube.streams.filter(only_audio=True).first()
@svpino
svpino / llama2-monsterapis.py
Last active August 14, 2023 17:36
Llama 2 - MonsterAPIs.
import requests
import json
from time import sleep
API_KEY = "INSERT YOUR API KEY HERE"
AUTHORIZATION = "INSERT YOUR AUTHORIZATION TOKEN HERE"
url = "https://api.monsterapi.ai/apis/add-task"
fetch_url = "https://api.monsterapi.ai/apis/task-status"
@svpino
svpino / file.py
Created June 16, 2023 13:19
OpenAI's API undocumented function calling python
import openai
openai.api_key = "YOUR KEY GOES HERE"
def get_completion(messages):
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo-0613",
messages=messages,
functions=[{
"name": "fake",
import re
import asyncio
import os
from bs4 import BeautifulSoup
from bs4.element import NavigableString
from playwright.async_api import async_playwright
USERNAME = "USERNAME HERE"
PASSWORD = "PASSWORD HERE"
@svpino
svpino / sample.py
Created March 21, 2023 14:24
Web Scraping using Bright Data Scraping Browser and Playwright
import re
import asyncio
from playwright.async_api import async_playwright
USERNAME = "TYPE YOUR USERNAME HERE"
PASSWORD = "TYPE YOUR PASSWORD HERE"
HOST = "zproxy.lum-superproxy.io:9222"
URL = "https://www.svpino.com/" # USE YOUR URL HERE