fabians.eth Profile picture
Oct 4 9 tweets 4 min read
thread on my process of getting GPT-3 to write a script to integrate #stablediffusion into google sheets, unlocking a function "stable()" that lets you gen images in sheets

GPT3 had already written an integration for itself for sheets, so I figured this should be doable, too
GPT-3 won't just mek app, it needs context

wanted to use @replicatehq's API for this, so as a first step I pasted their API documentation into GPT-3, along with: "The following is the documentation for calling the Replicate API:"

<FULL Documentation>

"Your task is to..."
"..write a Google Apps Script in JS code that allows a Google Sheets user to call this API using a function "stable(prompt)", where prompt passes on a string.

The following is needed to call the right model:

<curl to call right model>

Here is the App Script code:"
And the code GPT-3 came up with worked--ish...it sent the prompt to Replicate and Replicate created the right image, but the script would then try to use a function called "sheet.insertImage()" which didn't seem to work.

What I needed instead was the URL of the image..
So I wrote:

"Modify the code of our function in the following ways:
Get rid of all attempts to render an image. Delete all code that tries to use "insertImage". Then, modify the function to simply return the URL from "output" as a string into the currently active cell:"
Having learned *some* JS code from watching GPT-3 do it, I had the script write the output of what it was returning into my sheet and found it looked like this "JSON" (?) from the documentation (see image) - NOT the prediction, but some sort of status?
So this wasn't the actual prediction! I had to tell GPT-3 to get the actual prediction first, and then retrieve the URL from that.

I wrote: "modify the function so that it takes the returned "id" from this object to call the API with GET <info from documentation>..."
..."Rewrite the function so that it gets the prediction, calling it in line with the above information. Once the prediction has succeeded, simply return the 'output' string:"

and that worked!

gpt3 used a while loop to wait for the prediction to succeed & then returned the URL
and this is how i got a function stable(prompt) that would return a #stablediffusion image URL which I could then display within sheets with =IMAGE(URL)

funnily, by that point I had gained some understanding of what the code was actually doing and was able to modify it myself

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with fabians.eth

fabians.eth Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @fabianstelzer

Oct 3
HOLOSHEET, story edition!

built a google sheet powered by GPT-3 and #stablediffusion that outputs full stories, with images!

you input a prompt & the AIs generate story, visuals and a title

in any style you want..

here's "The wizard approached the abyss"

a few seconds later:
it's a PoC, so the stories are simple, but in return you can do any world...don't like Tolkien? How about Star Trek?

Here's what it outputs for:

"Red Alert! The Captain gasps awake..."
- in the style of Star Trek

all gpt-3 + stable within a single google sheet:
HOLOSHEET lets you mix and match styles, e. g. historical drama with science fiction for this one..

Prompt: "aztec temple, earthquake, aliens"

output:
Read 12 tweets
Sep 28
"Prompt Explorer" - a GPT-3 powered google sheet that lets you explore the "narrative neighbourhood" of any prompt:

eg "abandoned futuristic colony" will output detailed MJ/SD ready prompts for:

1. what's above (drone view)? 🚁
2. what's inside? 🔦
3. what's nearby? 🧭
drone view / fly above & the gpt-3 generated prompt

(hard to get consistency here without textual inversion) film still cinematic photography of the camera drone zooms i
"Go inside" view & the gpt-3 generated prompt

no one's been here for ages...
Read 10 tweets
Sep 26
cool applications of my GPT-3-powered* Google Sheet:

let GPT-3 write you any Google Sheet function...
- just tell it wat u want in the sheet! 🫰

no more googling 😅

Make a copy & use w your API key:

docs.google.com/spreadsheets/d…

*the script for this was written by GPT-3, too..🙈 ImageImage
fun applications of my GPT-3-written Google Sheet that lets you call gpt3(Cell):

a prompt generator for #DeforumDiffusion - input a simple base prompt, the sheet will generate interesting variations

below: "a flower"

docs.google.com/spreadsheets/d…

(make a copy w/ ur API key)
cool applications of my GPT-3-powered Google Sheet:

Generate lore and stories for RPG characters just from their numerical attributes

PoC, but for this one you just enter Strength, Dexterity and Intelligence values (0-20).

GPT-3 will write story/lore for the character: ImageImageImage
Read 4 tweets
Sep 2
"Narrative APIs" for composable gaming..?

a fun idea in crypto gaming is composability: take your game assets into other worlds

modulo desirability (personally think it'd be fun), how?

hard-coded standards seem unrealistic..

what if both games ran on GPT-3 tho? ImageImageImage
The "prompt maximalist" vision of composable gaming:

take any game worlds, e. g. @chain_runners and @lootproject

if both are governed by a world building prompt, (establishing their lore & physics), you could easily bridge any asset...

"lore inpainting" > narrative APIs Image
so instead of establishing hard rules or standards around how assets & characters between different worlds would interact with one another, you just let a language model figure it out on the fly

build deterministic censoring rules on top of that
Read 4 tweets
Sep 1
A collaborative AI-native "game":

𝐓𝐇𝐄 𝐓𝐎𝐖𝐄𝐑 𝐎𝐅 𝐃𝐀𝐋𝐋-𝐄 🗼

comment with a prompt *or* a DALL-E outpaint to add a section 🔽

RT with your DALL-E outpaint to branch off 🔼

prompt in image alt! alter tiny, radical bits...

+add your ENS, if u like 👀 Tower of Babel section, sumerian architecture, complex illus
here's an example extension I did, building a section on top and one below with DALL-E's new outpainting feature

IT'S TIME TO BUIDL 𝐓𝐇𝐄 𝐓𝐎𝐖𝐄𝐑 𝐎𝐅 𝐃𝐀𝐋𝐋-𝐄 🗼
ideally, youd buidl on top of the latest creation, but we can stitch together random sections too I guess..

THE SKY IS THE LIMIT lol
Read 6 tweets
Aug 31
Midjourney, DALL-E & SD images are incred, but the real 🤯 is when you realize you can make films with them

e.g. @SALT_VERSE, my 100%-AI film experiment

it all started with this MJ image, which instantly pulled me into a 70s sci-fi world - wtf is this place??

I had to go in 🫡
I "played" Midjourney to go a littler deeper into these mines - (many ppl use it like that, like a game!)

and damn, did I find some strange strange down there

a resource curse, of sorts?

I fired up DaVinci Resolve (free video editor) to create a trailer of "what I had seen"...
The experience of being able to "prompt a trailer into existence" on the fly while discovering this world myself was incredibly thrilling, a glimpse of the future

I began to wonder what others might find in this universe & set up Twitter community votes for the first "episode":
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(