Skip to content

Instantly share code, notes, and snippets.

@sqrt10pi
sqrt10pi / ollama.py
Created April 7, 2024 17:27
gpt-author with local models
import re
import requests
def remove_first_line(test_string):
if test_string.startswith("Here") and test_string.split("\n")[0].strip().endswith(":"):
return re.sub(r'^.*\n', '', test_string, count=1)
return test_string
def try_until_successful(fn):
while True:
Chapter 1: The Encounter
As the sun began to set on that fateful day, a warm golden light bathed the small town of Willow Creek. The tranquil atmosphere seemed almost surreal as the residents went about their evening routines. Little did they know, a life-altering event was just around the corner, one that would forever change the way they saw the world around them.
Our protagonist, young Benjamin "Ben" Shaw, was an avid reader and amateur cryptozoologist, his fascination with mythical creatures only growing stronger by the day. Ben's parents, Alice and Jack Shaw, were both successful professionals who worked long hours in the city, leaving their teenage son to spend most of his time alone at home. This solitude allowed him to indulge in his favorite hobby - researching cryptids.
On this particular evening, as darkness started to descend upon Willow Creek, Ben found himself engrossed in a book about various mysterious creatures that were believed to roam the Earth's wildest corners. He had just reached a s