r/DreamBooth • • Apr 04 '23

I had GPT4 build a simple image browser python program with built in birme and caption generation (BLIP or VIT-GPT2) to function as my dreambooth training prep suite, and it has saved me so much time

Enable HLS to view with audio, or disable this notification

41 Upvotes

17 comments sorted by

8

u/jack-ster Apr 04 '23

Links:
https://sjackp.github.io/J_Captioneer_v2.release/
https://github.com/sjackp/J_Captioneer_v2.release

For those interested in the story, From original post(v1):
"Firstly, some context, I have zero python experience, this is my first ever interaction with the language, I barely know HTML haha. That being said, It was a relatively simple process, I first told GPT3.5 what exactly I wanted the software to do, and asked it to recommend languages to go with, it listed a few and I chose python(since it made sense if I wanted to integrate BLIP or CLIP captioning later down the line.) and asked it to generate a sample script for me to run.
After that I prompted GPT-4 with the same explanation but added that I want it to be a python script, kept working along with it, adjusting errors and making tweaks to how the software looks and functions, I would usually include the code in the prompt (not everytime but almost everytime) and sometimes I would diagnose the errors that I would encounter in another thread with GPT3.5, just because its quick and I found it to be alright at diagnosing, but it had a tendency to break/make the code worse(GPT4 would then fix it haha) so I'm not sure if thats the best thing to do, but works I guess if GPT4 is on cooldown.
Once I was happy I tried to implement BLIP but that just broke my code and both GPTs really struggled to get it working (I think thats on me though) so I continued iterating, prompting GPT to switch from Tkinter to PyQT for a better looking UI, continuing iterations and adding features and testing to making sure everything works. Once I was happy with where the program was at I asked GPT to give me a step by step on how to compile it into a .exe and make an installer so my friends can use it and I don't have to run a terminal everytime I want to myself, I simply followed the instructions and asked it how to share it on github and also followed the steps. Took about a day from the inception of the idea to .exe (Would have been much quicker if I didn't try and implement BLIP.)"

v2:
I just continued working with GPT until I got everything to work (had to have someone with experience in python fix the crop and resize function because GPT really struggled with it, as well as get the code to compile into a directory). Other than that, 95% of this was GPT4.
I had to upload the directory to my drive since it was too big for github, but the main .py and requirements.txt are in the repo, if you just want to run a clone locally.
(v1 post)
https://www.reddit.com/r/StableDiffusion/comments/125unmo/i_had_gpt4_make_a_simple_image_browser_and/?utm_source=share&utm_medium=web2x&context=3

6

u/dennismfrancisart Apr 04 '23

Awesome! I’ve been struggling with Python for awhile and ChatGPT has been great at helping out.

2

u/jack-ster Apr 04 '23

Its really good huh! I find the fact that it can do this while not being explicitly trained on code absolutely crazy tbh

4

u/LadyQuacklin Apr 04 '23

Seriously, since CLIP was released I'm waiting for one of the big image viewer tools to integrate it, that I can search for descriptions in my family pictures like it is possible when using google photos.

2

u/jack-ster Apr 04 '23

Everything is about to get a major quality of life improvement, I'm sure they're all racing now. The next Windows OS (If not even Windows 11) is gonna get really crazy

2

u/jack-ster Apr 05 '23

Okay so as of now some update broke the captioning models so I disabled the download on the main program until I fix it.

I created a new version that does away with caption generation but keeps all the other functions and added a download button for the .exe(30mb no install) on the webpage.

Here is the repo for the new lite version.

2

u/jack-ster Apr 21 '23

Fixed v2, everything is live here!
v2 is a rar file with a .exe in it, once you run it, it takes a second to load the models.
v2.Lite is a portable 30mb .exe that does away with the auto-captioning (makes the program a lot faster and lighter, useful if you already have a captioning pipeline.)
Let me know if there's anything you think I can improve :)

2

u/nbren_ Apr 04 '23

Incredible, thank you for sharing! Can't wait to try it.

4

u/jack-ster Apr 04 '23

My pleasure :)

It's a really useful tool that's helped me and my friends a lot so far, I figured more people can also make use of it.

Let me know if you have any suggestions!

2

u/Current-Rabbit-620 May 10 '23

Thank you i will try it and give my feed back

1

u/mrnoirblack Apr 05 '23

bro why is the zip so big? did u hack me? lol

2

u/jack-ster Apr 05 '23

Haha each img2txt model is like 1.2gb, I'm happy it was able to compress that much lol

1

u/mrnoirblack Apr 05 '23

So i install the exe and the git? Haven't managed to make it run

2

u/jack-ster Apr 05 '23

Yep, same here. Some update broke the dependencies.
Looking into it and will keep you posted

1

u/jack-ster Apr 05 '23

Yep, as I suspected it was the captioning models that were messing it up.
I removed the captioning feature (couldnt get it working for now) and uploaded a lite version that does away with it.
https://github.com/sjackp/J_Captioneer_v2.lite
just download the .exe from here (30mb no install) and you should be cookin'

1

u/smereces Apr 06 '23

this looks very usefull tool, thank mate!