Generating Stories With LLMs And Stable Diffusion
Generating Stories and Story ideas with Cohere and Stable Diffusion
Describe your story in two sentences, then guide Cohere's language model as it turns it into a bigger story.
Your story description, called the log line, will then be used to generate the story title, characters, plot, location descriptions, and scene dialog. This is done with a different prompt for each of these components.
This notebook follows the method and prompts described in the paper Co-Writing Screenplays and Theatre Scripts with Language Models: An Evaluation by Industry Professionals by Piotr Mirowski, Kory Mathewson, Jaylen Pittman, Richard Evans.

Enter your Cohere API Key·········· Enter your Dream Studio API Key··········
INFO:stability_sdk.client:Opening channel to grpc.stability.ai:443 INFO:stability_sdk.client:Channel opened to grpc.stability.ai:443
Story Summary
All we have to do is write a story summary. The model generates the rest.
This brief description is called the log line.
============ Generation 0 <character> Howard (pseudonym) <description> Howard is a professional Bitcoin hacker. <stop> <character> Max (pseudonym) <description> Max is a professional hacker, whose client was recently hacked. He asks Howard to look into the matter. <stop> <character> Nick (pseudonym) <description> Nick is a Cyber Intelligence Agent of the Feds. <stop> <character> Lise (pseudonym) <description> Lise is Max's partner in crime. <stop> <end> ============ Generation 1 <character> John Doe #1 <description> John Doe #1 is a teenager from the UK. A cyberpunk hacker who enjoys finding bugs in code. He works at the defunct mobile phone company GPS and develops his own programs. <stop> <character> Jane Doe #2 <description> Jane Doe #2 is a single mother from San Francisco. A cyberpunk hacker who enjoys making malware. She works at a security company and hacks for fun. <stop> <end> ============ Generation 2 <character> Anna Jackson <description> An African-American hacker, in her early 30s. Anna works in Downtown Chicago, where she operates under the pseudonym "Anonymous." She's a member of a team of hackers that call themselves "The Underground". <stop> <character> John Harper <description> A computer programmer in his late 20s. He lives in Skokie, Illinois. <stop> <character> Abner <description> A robot agent. <stop> <character> Computer hacker - Anthony Meyer <description> Anthony Meyer is an international cyber hacker, working in Europe. He is an independent hacker who works for money. <stop> <character> Cyber intelligence agent <description> A special agent for the Cyber Intelligence Agency in Washington DC, who is on the trail of hackers who stole $3.5 million worth of Bitcoin. <stop> <character> Lee "Evil" Patton <description> An infamous hacker. He is on the run from the FBI and the Cyber Intelligence Agency. <stop> <character> Cyber intelligence agent - Tina Parker <description> A special agent for the Cyber Intelligence Agency. She has been hunting Lee "Evil" Patton for over a year. <stop> <character> Madame X <description> An international hacker and one of Lee "Evil" Patton's old hacker friends. She is one of the few hackers who can identify Lee "Evil" Patton. <stop> <end>
['Howard is a professional Bitcoin hacker.', , 'Max is a professional hacker, whose client was recently hacked.\nHe asks Howard to look into the matter.', , 'Nick is a Cyber Intelligence Agent of the Feds.', , "Lise is Max's partner in crime."]
Visualize Characters with Stable Diffusion
Now that we have character descriptions, we can generate possible images showing them. We can get some style descriptions from Lexica.art.
INFO:stability_sdk.client:Sending request. INFO:stability_sdk.client:Got keepalive e71266c1-80f7-4cdf-8c4c-72c2d1695e30 in 0.16s
Max is a professional hacker, whose client was recently hacked. He asks Howard to look into the matter. portrait futuristic cyberpunk, in heavy rainning futuristic tokyo rooftop cyberpunk night, ssci-fi, fantasy, intricate, very very beautiful, elegant, neon light, highly detailed, digital painting, artstation, concept art, soft light, hdri, smooth, sharp focus
INFO:stability_sdk.client:Got keepalive e71266c1-80f7-4cdf-8c4c-72c2d1695e30 in 3.01s INFO:stability_sdk.client:Got e71266c1-80f7-4cdf-8c4c-72c2d1695e30 with ['ARTIFACT_IMAGE', 'ARTIFACT_CLASSIFICATIONS', 'ARTIFACT_LATENT'] in 0.23s
INFO:stability_sdk.client:Sending request.
None
INFO:stability_sdk.client:Got keepalive 17900276-1e5c-4783-91a9-04ef411015fa in 1.00s INFO:stability_sdk.client:Got keepalive 17900276-1e5c-4783-91a9-04ef411015fa in 3.14s INFO:stability_sdk.client:Got 17900276-1e5c-4783-91a9-04ef411015fa with ['ARTIFACT_IMAGE', 'ARTIFACT_CLASSIFICATIONS', 'ARTIFACT_LATENT'] in 0.24s
INFO:stability_sdk.client:Sending request.
None
INFO:stability_sdk.client:Got keepalive 21c32d95-29e6-4fba-af29-c80caa7d97b4 in 1.02s INFO:stability_sdk.client:Got keepalive 21c32d95-29e6-4fba-af29-c80caa7d97b4 in 3.14s INFO:stability_sdk.client:Got 21c32d95-29e6-4fba-af29-c80caa7d97b4 with ['ARTIFACT_IMAGE', 'ARTIFACT_CLASSIFICATIONS', 'ARTIFACT_LATENT'] in 0.22s
None
INFO:stability_sdk.client:Sending request. INFO:stability_sdk.client:Got keepalive 16cdeb23-9e20-4638-858e-b0b716bbd554 in 2.65s INFO:stability_sdk.client:Got keepalive 16cdeb23-9e20-4638-858e-b0b716bbd554 in 3.10s INFO:stability_sdk.client:Got 16cdeb23-9e20-4638-858e-b0b716bbd554 with ['ARTIFACT_IMAGE', 'ARTIFACT_CLASSIFICATIONS', 'ARTIFACT_LATENT'] in 0.21s
Narrative Structure

============ Generation 0 Place: Office building in New York. Plot element: 1- The Ordinary World. Beat: Howard works in a grubby office as a professional Bitcoin hacker. Place: Laundromat in Brooklyn. Plot element: 2- Call to Adventure. Beat: Max asks Howard to hack his client's account and discover who was behind the hack. Place: A public Wi-Fi network. Plot element: 3- Refusal of the Call. Beat: Howard is hesitant to take on the case, because he has an important audition. Place: Laundromat in Brooklyn. Plot element: 4- Crossing the First Threshold. Beat: Howard accepts the case and meets Max in person. Place: Internet café. Plot element: 5- The Approach to the Inmost Cave. Beat: Howard meets Nick and learns of Lise. Place: A park. Plot element: 6- The Ordeal and The Reward. Beat: Howard and Max both become targets of Nick's investigation, but they do not know why. <end>
Location Description
Let's now generate a description for each place mentioned in the story structure.
location: Office building in New York generated description: The offices are shabby, mostly vacant, and have only the most rudimentary security measures. There is one office that is not quite empty. The two hackers are at the office door. <end> location: Laundromat in Brooklyn generated description: A grimy, damp basement, with low ceilings, grimy yellowed tiles, and grey concrete floor. The smell of detergent and soap hangs in the air. The launderette is deserted, and all of the machines are broken. <end> location: A public Wi-Fi network generated description: A busy network that a person can log into to check their email, etc. It is open to the public and there are lots of people using it. There is also a security warning that pops up that tells you that the network is not secure and to be careful. <end> location: Internet café generated description: A dimly lit, dirty-carpeted room full of old computers and cables. Now, if I were to ask someone for a description of place, I might get something like the following: Example 1. Morgan lives in a big, blue house with a little porch. Place: Morgan's house. Place Description: It is a big, blue house with a little porch. There is a fence in the front, with a red curb location: A park generated description: It is a very common place, somewhere everyone has been to. The grass is well-kept, the flowers are in good shape, and there are no dents in the benches. It is very bright, with plenty of sunlight, and very few clouds in the sky. <end>
INFO:stability_sdk.client:Sending request.
shabby, mostly vacant offices. Two hackers are at the office door. ultra mega super hyper realistic Digital concept interior design. stone walls and neon lights, a lot of electronics. Natural white sunlight from the transperient roof. Rendered in VRAY and DaVinci Resolve and MAXWELL and LUMION 3D, Volumetric natural light
INFO:stability_sdk.client:Got keepalive a572398f-2445-40b1-960e-da7cc76f585a in 2.23s INFO:stability_sdk.client:Got keepalive a572398f-2445-40b1-960e-da7cc76f585a in 3.08s INFO:stability_sdk.client:Got a572398f-2445-40b1-960e-da7cc76f585a with ['ARTIFACT_IMAGE', 'ARTIFACT_CLASSIFICATIONS', 'ARTIFACT_LATENT'] in 0.21s
INFO:stability_sdk.client:Sending request.
None
INFO:stability_sdk.client:Got keepalive 7d2ac518-1d76-4e3a-b13b-f13cb05eaaee in 3.76s INFO:stability_sdk.client:Got keepalive 7d2ac518-1d76-4e3a-b13b-f13cb05eaaee in 2.88s INFO:stability_sdk.client:Got 7d2ac518-1d76-4e3a-b13b-f13cb05eaaee with ['ARTIFACT_IMAGE', 'ARTIFACT_CLASSIFICATIONS', 'ARTIFACT_LATENT'] in 0.20s
INFO:stability_sdk.client:Sending request.
None
INFO:stability_sdk.client:Got keepalive acd1498c-a514-4a18-823e-b3139aa20e98 in 3.30s INFO:stability_sdk.client:Got keepalive acd1498c-a514-4a18-823e-b3139aa20e98 in 3.10s INFO:stability_sdk.client:Got acd1498c-a514-4a18-823e-b3139aa20e98 with ['ARTIFACT_IMAGE', 'ARTIFACT_CLASSIFICATIONS', 'ARTIFACT_LATENT'] in 0.21s
None
DAVE Alice, are you ready? ALICE I've been ready for a half hour. DAVE I have my ID. ALICE I've got my wallet. DAVE You got the flash drive? ALICE Yeah. DAVE You have the pin? ALICE Yeah. DAVE We're not the only people here. ALICE I know. DAVE We'll need to work fast. ALICE We need to work fast. DAVE Don't get greedy. ALICE Don't get greedy. DAVE Let's get in there. ALICE Let's get in there. <dialog> ALICE Where are you going? DAVE I'll be right back. ALICE I'm gonna go check on her. DAVE Check on her? ALICE Yeah, you know, check on her. DAVE No you're not. ALICE I am too. DAVE You're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE No you're not. ALICE Yes I am. DAVE