Skip to content

Instantly share code, notes, and snippets.

View simonw's full-sized avatar

Simon Willison simonw

View GitHub Profile
uv run --with pillow --with google-genai python -c '
import os
from google import genai
from google.genai import types
from io import BytesIO
from PIL import Image

GEMINI_API_KEY = os.environ["GEMINI_API_KEY"]
@simonw
simonw / speak.py
Last active February 12, 2025 15:07
Simple script to try out https://github.com/hexgrad/kokoro
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "click",
# "kokoro",
# "misaki[en]",
# "soundfile",
# ]
# ///
import click
@simonw
simonw / geocode.py
Created January 26, 2025 16:49
Geocode using the API bulit into macOS CoreLocation
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "pyobjc-core",
# "pyobjc-framework-CoreLocation",
# "click"
# ]
# ///
"""Basic geocoding using CoreLocation on macOS."""
# /// script
# dependencies = [
# "pyobjc-core",
# "pyobjc-framework-CoreLocation"
# ]
# ///
"""Get named timezone for a location on macOS using CoreLocation
To use this script, you need to have pyobjc-core and pyobjc-framework-CoreLocation installed:
@simonw
simonw / response.json
Created January 1, 2025 16:04
GPT-4o audio response
This file has been truncated, but you can view the full file.
{
"id": "chatcmpl-AkvTd3qWivjaB4rHJUSMAu7UJRTsM",
"object": "chat.completion",
"created": 1735747393,
"model": "gpt-4o-audio-preview-2024-12-17",
"choices": [
{
"index": 0,
"message": {
@simonw
simonw / response.json
Created December 18, 2024 02:07
GPT-4o audio response
This file has been truncated, but you can view the full file.
{
"id": "chatcmpl-Afdl8zH5y8xDqqdZi7UiPyYZfkP58",
"object": "chat.completion",
"created": 1734487646,
"model": "gpt-4o-audio-preview-2024-12-17",
"choices": [
{
"index": 0,
"message": {
@simonw
simonw / response.json
Created December 18, 2024 02:07
GPT-4o audio response
This file has been truncated, but you can view the full file.
{
"id": "chatcmpl-AfdkL95RjVZiUuJIUWdS0CCi7iM0S",
"object": "chat.completion",
"created": 1734487597,
"model": "gpt-4o-mini-audio-preview-2024-12-17",
"choices": [
{
"index": 0,
"message": {
@simonw
simonw / response.json
Created December 17, 2024 21:49
GPT-4o audio response
This file has been truncated, but you can view the full file.
{
"id": "chatcmpl-AfZjInFYyuKnJGB7UeC613oqPJFyF",
"object": "chat.completion",
"created": 1734472156,
"model": "gpt-4o-audio-preview-2024-12-17",
"choices": [
{
"index": 0,
"message": {
@simonw
simonw / response.json
Created November 29, 2024 01:38
GPT-4o audio response
{
"id": "chatcmpl-AYkFZgbbiEHMbPep0zSJqZgKy98tb",
"object": "chat.completion",
"created": 1732844301,
"model": "gpt-4o-audio-preview-2024-10-01",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
@simonw
simonw / response.json
Created November 28, 2024 17:26
GPT-4o audio response
{
"id": "chatcmpl-AYcVyamO3LWB0bHxdEce5LIQFxiyr",
"object": "chat.completion",
"created": 1732814566,
"model": "gpt-4o-audio-preview-2024-10-01",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",