LevwTech / wa-gpt

💬 Chat, Create Stickers & Images, Send Voice Notes, Files, and More! 🎨 Start now for free! ✨
https://whatsapp-assistant.com
2 stars 1 forks source link

Remove background from stickers #4

Open LevwTech opened 7 months ago

LevwTech commented 7 months ago

Current sticker implementation is fine for a v1.0

LevwTech commented 7 months ago

I have already tried using image processing for this but the libraries where too large and exceeded the 250 limit of lambda bundled function size.

I also tried using layers but found that the 250mbs limit includes layers as well.

I tried running the background removal logic on server on digital ocean so i can call the endpoint from my lambda, but found that the imgly/background-removal-node package doesn't seem to work on ubuntu or linux environments, as i also tried running a droplet and ran the server inside it and gave me a cpp error.

LevwTech commented 7 months ago

For now i removed the black background request from the sticker generation prompt, and simply asked it to apply a solid background so the stickers seem more nice.

LevwTech commented 7 months ago

This issue can be either solved by:

1) re-add in the prompt the black background request, and remove it by using the black background and the white stroke and manually create a function using sharp that applies segmentation techniques and thresholding to remove the black background in-house without using the large imgly background removal node package

or

2) Fork the imgly background removal node package and try to remove just enough things so that it can pass through the lambda bundle limit, you need to reduce around 40mbs in size, one solution is to remove the large and small bundle models and just rely on the medium one.

LevwTech commented 6 months ago

try out deploying the new uptotec's background removal library that relies on jimp instead of sharp for i/o or use a well established python package and deploy it on a django or flask webserver, set up an api key to make sure only you use it

or use replicate or fal.ai