Skip to content

Instantly share code, notes, and snippets.

@JBudgeME
JBudgeME / main.py
Last active September 3, 2024 14:31
Infinite Scroll FastHTML / HTMX - Python
from fasthtml import FastHTML
from fasthtml.common import *
app = FastHTML(hdrs=(picolink,))
def create_card(number):
return Div(Small(f"Item {number}"))
@app.get("/")
def home():
@thomwolf
thomwolf / fast_speech_text_speech.py
Last active October 18, 2024 21:06
speech to text to speech
""" To use: install LLM studio (or Ollama), clone OpenVoice, run this script in the OpenVoice directory
git clone https://github.com/myshell-ai/OpenVoice
cd OpenVoice
git clone https://huggingface.co/myshell-ai/OpenVoice
cp -r OpenVoice/* .
pip install whisper pynput pyaudio
"""
from openai import OpenAI
import time
@ivanfioravanti
ivanfioravanti / gist:bcacc48ef68b02e9b7a4034161824287
Created January 25, 2024 00:01
Fine tuning dataset generation wiht Ollama python library
import json
import os
import ollama
def query_ollama(prompt, model='openhermes:7b-mistral-v2.5-q6_K', context=''):
response = ollama.generate(
model=model,
prompt=context + prompt)
return response['response'].strip()
@karpathy
karpathy / stablediffusionwalk.py
Last active October 1, 2024 09:56
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
@ines
ines / Install
Last active September 21, 2023 17:14
Streamlit + spaCy
pip install streamlit
pip install spacy
python -m spacy download en_core_web_sm
python -m spacy download en_core_web_md
python -m spacy download de_core_news_sm
import tensorflow as tf
import numpy as np
corpus_raw = 'He is the king . The king is royal . She is the royal queen '
# convert to lower case
corpus_raw = corpus_raw.lower()
words = []
for word in corpus_raw.split():
@mommi84
mommi84 / awesome-kge.md
Last active September 11, 2024 16:32
Awesome Knowledge Graph Embedding Approaches
@shagunsodhani
shagunsodhani / Question Answering with Subgraph Embeddings.md
Created June 1, 2016 16:33
Notes for "Question Answering with Subgraph Embeddings" paper

Question Answering with Subgraph Embeddings

Introduction

  • Open-domain Question Answering (Open QA) - efficiently querying large-scale knowledge base(KB) using natural language.
  • Two main approaches:
    • Information Retrieval
      • Transform question (in natural language) into a valid query(in terms of KB) to get a broad set of candidate answers.
      • Perform fine-grained detection on candidate answers.
  • Semantic Parsing
@vasanthk
vasanthk / System Design.md
Last active November 17, 2024 05:38
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@karpathy
karpathy / min-char-rnn.py
Last active November 16, 2024 23:10
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)