· 4 years ago · Aug 09, 2021, 08:26 PM
1import openai
2
3openai.api_key = 'YOUR API KEY GOES HERE'
4
5
6def invent(prompt, token_length, attempts_remaining=3):
7 if attempts_remaining <= 0:
8 return ''
9
10 response = openai.Completion.create(
11 engine="curie",
12 prompt=prompt,
13 temperature=0.93,
14 max_tokens=token_length,
15 # top_p=1,
16 frequency_penalty=0.5,
17 presence_penalty=0.75,
18 stop=["\n"])
19
20 #print(response)
21
22 result = response['choices'][0]['text']
23 if result.strip():
24 return result.strip()
25 else:
26 # print('bad result:', result)
27 return invent(prompt, token_length, attempts_remaining=attempts_remaining - 1)
28
29club_title = invent(prompt="""Saturday Night Live: New York's Hottest Clubs
301. Hooyagoosyoughoooou
312. Crease
323. Uhhhhhh
334. Your Mother and I Are Getting a Divorce
345.""", token_length=35)
35
36club_description = invent(prompt="""Saturday Night Live: New York's Hottest Clubs (Satire)
371. ...Really?. Conceived in the moist vortex of a sweaty threesome involving Rick Perry, Tyler Perry, and William "the Refrigerator" Perry, this pestilential deathtrap is located in the pus-filled discharge of an unlicensed laundromat on the lower west end of the Upper East Side. Don't forget the password: it's "[raises right eyebrow]".
382. Crease. Located in the middle of the West Side Highway, this bi-curious beach party is the creation of Italian club owner Baloney Danza.
393. Scotch Over, Marty! Located in an old Bolivian woman's stigmata holes, this former whale hostel finally answers the question, "What would a sauna filled with a dozen cyberpunk Billy Crystals smell like?" The password to gain entry is your Aunt Melba's dying words.
404. """ + club_title + ".", token_length=256)
41
42club_has = invent(prompt="""Saturday Night Live: New York's Hottest Clubs (Satire)
431. Slice. This place has everything: Twinks, gypsies, grown men in wedding dresses, a cat from a bodega, puppets in disguise.
442. Crease. This place has everything: Trance, stilts, throw-up music, an albino that looks like Susan Boyle, Teddy Graham people.
453. """ + club_title + ". This place has everything:", token_length=128)
46
47last_thing = club_has.split(",")[-1].strip()
48if last_thing.startswith("and "):
49 last_thing = last_thing[4:]
50last_thing = last_thing[0].upper() + last_thing[1:-1]
51
52club_explain = invent(prompt="""Satirical answers only:
531. Puppets in disguise? It’s that thing where Alf wore a trench coat, so he could go out into public.
542. DJ Baby Bok Choy? He’s a giant 300-pound Chinese baby who wears tinted aviator glasses, and he spins records with his little ravioli hands.
553. Human Moon Boots? It’s that thing where two midgets dressed as astronauts are strapped to your feet and you hop around using them as springs when you want to simulate zero gravity.
564. Human jumper cables? It’s that thing of where a midget touches your engine and he’s holding hands with a long line of other midgets and at the end, one of them sticks a fork in an electrical socket.
575. """ + last_thing + "?", token_length=128)
58
59print(f"Yesyesyesyesyesyes. New York's hottest club is {club_title}.")
60print(club_description)
61print()
62print("This place has everything:", club_has)
63print()
64print(f" - All right, Stefon, I'll bite. {last_thing}?")
65print(club_explain)