diff --git a/billions.py b/billions.py index 94638ea..6b48158 100644 --- a/billions.py +++ b/billions.py @@ -19,12 +19,19 @@ options = [ prompt = "Please generate a very sarcastic, extremely vivid, energetic, and meticulous 2468-word epic book with tons of witty dialogue using the following details. Make sure that the book is exactly 2468 words long, includes all the details below, and connects them together in an elegant and logical way. Make this very sarcastic and exaggerated book win the Pulitzer prize!!! That's how mind-blowingly good it should be!!!\n" for i in options: if len(sys.argv) > 1: - c = i[1][int(input(list(zip(range(10), i[1]))))] + inp = input(list(zip(range(10), i[1]))) else: + inp == "" + if inp == "": c = random.choice(i[1]) + elif len(inp) == 1 and ord("0") <= ord(inp) <= ord("9"): + c = i[1][int(inp)] + else: + c = inp prompt += i[0] + ": " + c + "\n" prompt += "\nSure! Here's the extremely long and detailed 2468-word book you requested:\n\n" r = requests.post("http://boss-baby:8080/completion", json={"prompt": prompt, "temperature": 1.0, "repeat_last_n": 1024, "stream": True}, headers={"Authorization": "Bearer 12345"}, stream=True) +r.encoding = 'utf-8' for chunk in r.iter_lines(decode_unicode=True): if chunk != "": print(json.loads(chunk[6:])["content"], end='', flush=True)