Skip to content

Instantly share code, notes, and snippets.

@jeffehobbs
jeffehobbs / owl.py
Created June 19, 2024 02:04
image upload and detection flask app
# owl.py | jhobbs@advance.net
#
# GOAL: upload a PDF, convert it to an image, and perform OpenAI vision capabilities on the image
#
# TO DO:
# 1. [X] upload PDF or image
# 2. [X] change PDF to image
# 3. [X] upload default prompt
# 4. [X] perform vision API call
# 5. [X] splat response back to client
@jeffehobbs
jeffehobbs / rando.py
Last active June 14, 2024 10:29
a code sample to demonstrate random sampling to estimate large numbers
# rando | jeffehobbs@gmail.com
#
# a code sample to demonstrate random sampling to estimate large numbers
import random
# globals
LARGE_NUMBER = 1000000
CHANCE = 20 # as in "1 in 20"
@jeffehobbs
jeffehobbs / escalator_music.py
Last active June 12, 2024 18:13
Ollama creates the prompt, Stable Audio renders music based on the prompt. wash rinse repeat
import ollama
import hashlib
from pydub import AudioSegment
import torch
import torchaudio
from einops import rearrange
from stable_audio_tools import get_pretrained_model
from stable_audio_tools.inference.generation import generate_diffusion_cond
@jeffehobbs
jeffehobbs / mississippi.json
Created March 13, 2024 13:35
List of cities and towns of Mississippi
[
"Abbeville",
"Aberdeen",
"Ackerman",
"Algoma",
"Alligator",
"Amory",
"Anguilla",
"Arcola",
"Artesia",
@jeffehobbs
jeffehobbs / texas.json
Created March 13, 2024 13:33
List of municipalities in Texas
[
"Abbott",
"Abernathy",
"Abilene",
"Ackerly",
"Addison",
"Adrian",
"Agua Dulce",
"Alamo",
"Alamo Heights",
@jeffehobbs
jeffehobbs / dallewood.py
Created November 22, 2023 23:25
bulk generator of terrible AI images
# dallewood | jeffehobbs@gmail.com
import typer, configparser, os, shutil, requests, hashlib, openai
from tqdm import tqdm
app = typer.Typer()
OUTPUT_DIR = '/output'
OUTPUT_PROMPT_PREFIX = ''
# generate image from post text
@jeffehobbs
jeffehobbs / ariseCthulhuBot.py
Last active September 9, 2023 13:00
ariseCthulhuBot - using ML to summon The Old Ones
# ariseCthulhuBot.py | jeffehobbs@gmail.com
# taking the Great Tweets and sending them through the
# Lovecraftian-chaotic wheat thresher of the "bark" TTS library
# in order to summon The Old Ones
#
# to-do:
#
# 1. [X] get a CLASSIC tweet
# 2. [X] make a music intro
# 3. [X] make a text tweet
@jeffehobbs
jeffehobbs / birdnetpi_hardware.txt
Last active July 7, 2023 14:13
BirdNetPi Hardware List + Basic Instructions
Equipment for BirdNet
SUMMARY: You’ll need a decent Raspberry Pi, a case, a microSD card, a decent USB mic, a longish USB cable
and a decent power supply. It’ll run you about $150.
COMPUTER: RASPBERRY PI 4, 4GB ($55)
I’m using this, it works great. $55.
https://www.adafruit.com/product/4296
@jeffehobbs
jeffehobbs / radiodreambot.py
Last active June 1, 2023 23:32
record radio, transcribe it, make art
# radiodreambot | jeffehobbs@gmail.com
# record radio, transcribe it, make art
import requests, os, shutil, configparser, datetime, time, multiprocessing, openai, tweepy
from mastodon import Mastodon
from faster_whisper import WhisperModel
STREAM_URL = 'https://live.wostreaming.net/direct/saga-wrsifmaac-ibc2'
LOCAL_STREAM_OUTPUT_DIRECTORY = '/tmp/'
RUN_TIME = 60
@jeffehobbs
jeffehobbs / app.py
Last active July 8, 2023 16:27
AWS lambda wrapper for WeatherKit API + OpenAI Summarization
# generates a REST lambda for WeatherKit data & OpenAI summarization
import requests, json, os, boto3, configparser
from flask import Flask, Response, request, json, jsonify
import openai
app = Flask(__name__)
# set up API keys from external config secrets.txt configparser file
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))