Skip to content

Instantly share code, notes, and snippets.

View anotherjesse's full-sized avatar

Jesse Andrews anotherjesse

View GitHub Profile
@anotherjesse
anotherjesse / README.md
Created April 2, 2023 02:38
langchain + vectorstore of liked tweets

A first pass at creating a @langchain vectorstore for each tweet I have "liked"

I already store them as a json blob on https://lets.m4ke.org/tweets

This ingests them documents - each looking like @twitter_user_name says tweet_text_here

Samples:

>>> qa.run("what is @jakedahn tweeting about")

' @jakedahn is tweeting about art and creativity.'

@anotherjesse
anotherjesse / polling-vs-webhooks.md
Created March 14, 2023 22:04
polling vs webhooks - replicate-python

polling

model = replicate.models.get("replicate/hello-world")
version = model.versions.get("5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa")
inputs = {
  "text": "world",
}
output = version.predict(**inputs)

webhook

@anotherjesse
anotherjesse / clip_anti_interragtor.py
Created February 22, 2023 01:19
use clip interegator to create prompts
import json
import random
db = {}
def get_data(kind, count=1):
if kind not in db:
with open("clip_interrogator/data/{}.txt".format(kind)) as f:
@anotherjesse
anotherjesse / build-hack.md
Last active February 7, 2023 18:49
weights workaround

big picture

Build your docker image in a way that works with replicate, while limiting image "layers" to less than 20GB.

Steps

Build COG without weights

First build a version of the cog without weights. To do this ensure remove extra files/weights from your cog directory and then build.

@anotherjesse
anotherjesse / just-clip.py
Created October 11, 2022 00:35
running clip to get prompt embedding for stable diffusion
!pip install diffusers==0.4.0
!pip install transformers ftfy
from transformers import CLIPTokenizer, CLIPTextModel
import torch
torch_device = "cuda" if torch.cuda.is_available() else "cpu" # or just let it be cpu
prompt = ["a photograph of an astronaut riding a horse"]
@anotherjesse
anotherjesse / app.js
Created October 26, 2021 03:32
keypress-react-fibers-threejs
import React, { useState } from "react";
import ReactDOM from "react-dom";
import { extend, Canvas } from "react-three-fiber";
import DatGui, { DatColor, DatNumber, DatSelect } from "react-dat-gui";
import { Text } from "troika-three-text";
import fonts from "./fonts";
import "react-dat-gui/build/react-dat-gui.css";
import "./styles.css";
@anotherjesse
anotherjesse / README.md
Created September 25, 2021 13:35
golang ffmpeg imagepipe streaming

using golang to create image pipe for ffmpeg

If you want to stream a slideshow using ffmpeg, it seems like one easy way to do it is to create an imagepipe of the files.

This can then be streamed to twitch.tv or youtube ... https://trac.ffmpeg.org/wiki/StreamingGuide

This sample cycles between images on disk

usage

@anotherjesse
anotherjesse / TodoMVC.svelte
Created January 17, 2021 06:26
automerge custom store svelte todos
<script>
import {datastore} from './data.js';
const ENTER_KEY = 13;
const ESCAPE_KEY = 27;
let currentFilter = 'all';
let items = [];
let editing = null;
datastore.subscribe(db => {
import {writable} from 'svelte/store';
import Automerge from 'automerge';
if (typeof trikeQuit !== 'undefined' || trikeQuit !== null) {
document.addEventListener('keypress', e => {
if (e.metaKey && e.key === 'q') {
trikeQuit();
}
});
}
@anotherjesse
anotherjesse / tractor-todos-sqlite.go
Last active January 3, 2021 00:55
exploring sqlite3 + tractor engine
package main
import (
"database/sql"
"embed"
"log"
"github.com/manifold/tractor/toolkit/engine"
"github.com/mattn/go-sqlite3"
)