Please help me on writing the correct prompt for Chatgpt to generate a code

I need help writing the correct prompt in CHATGPT to generate a code in Python. Here is my problem statement.

I am writing a cycleGAN code in tensorflow. I want image masking in the first generator and pass the generated image to the 2nd generator, after the 2nd generator, I want to de-mask the generated image.

The main problem is to mask the image and cycleGAN can re-build the masked part and at the end, the new image will be the output.

I need help with how to prompt in CHATGPT, so that It can generate the exact code.


1 Like

If it’s not working, maybe try shorter sentences and more context to explain your situation like:

“I’m an AI developer working on Python code using tensorflow. Show me an example that uses cycleGAN. I want to have two generators in this code. The first generator should do image masking. The second generator should do de-masking of the image. The objective of this code is to…”

short sentences, with each one adding more info, that will fit in and clarify more detail about things in previous sentences.


Thanks @wclayf for your response. I tried and it is working quite better. Thanks for your suggestions :slight_smile:

1 Like

Cool. Glad it helped.

I use a pattern like this a lot: “I will be doing A because B. I will be doing B using of C. Be sure when you do C you remember D. When doing D I’d like to have E”.

What I mean is not the specific words of that prompt, but the fact that each sentence mentions something previously mentioned, so the whole prompt is seen as a single logical entity, and can be “followed” precisely by the “mind” of the AI, with every sub-part being able to be tied back to the original directive/objective as if rooted at a logical tree structure.


Love the logical approach. I am definitely going to use it in my prompts. That explains why I had to do some of my prompts in pieces. Thanks


@wclayf 100% agree, I always love to use a logical approach to achieve the objective.

1 Like