Skip to content

Instantly share code, notes, and snippets.

View anotherjesse's full-sized avatar

Jesse Andrews anotherjesse

View GitHub Profile
package main
import (
"fmt"
"math/rand"
"os"
"os/signal"
)
const (
@anotherjesse
anotherjesse / book-titles.txt
Created January 27, 2024 16:09
moondream-random.txt
seed: 0 output: The Complete Book of Modern Paisley (Paisley Collection)
seed: 1 output: The Complete Idiot's Guide to Doing Nothing
seed: 2 output: The Complete Guide to Cat Care
seed: 3 output: The Complete Idiot's Guide to Sewing, Stitching, Needlepoint, and More
seed: 4 output: The Complete Idiot's Guide to Tennis: Everything You Need to Know About Tennis, One Game at a Time
seed: 5 output: The Complete Guide to Building a Website (The Complete Guides)
seed: 6 output: The Complete Idiot's Guide to Baking
seed: 7 output: The Complete Guide to Bicycle Repair
seed: 8 output: The Complete Idiot's Guide to Gardening
seed: 9 output: Big Bird Singing Classic
def generate(prompt, filename):
# Simulate the generation process (you can replace this with your actual function)
print(f"Generating '{prompt}' and saving as '{filename}'")
# Options for each category
expressions = ["happy", "sad", "crying", "angry", "open mouth"]
genders = ["male", "female", "non-binary"]
ages = ["kid", "teen", "young adult", "adult", "old"]
ethnicities = ["Caucasian", "Hispanic", "Black", "Middle-Eastern", "South Asian", "East Asian"]
styles = ["realistic", "cartoon", "comics"]
@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 / gist:70718
Created February 26, 2009 07:07
Chart application health from New Relic in Munin
#!/usr/bin/env ruby
require 'open-uri'
require 'rexml/document'
require 'rexml/xpath'
url = 'http://rpm.newrelic.com/accounts.xml?include=application_health'
headers = {'x-license-key' => 'YOUR LICENSE KEY'}
@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";