[GH-ISSUE #478] Unused models in the application #375

Closed
opened 2026-02-26 12:21:23 +03:00 by kerem · 3 comments
Owner

Originally created by @Roboxkin on GitHub (Apr 13, 2024).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/478

Originally assigned to: @Roboxkin on GitHub.

Hello!
I can’t figure out how to make sure that only the necessary extensions are collected in the application.
No matter how much I try, I always get 1.5 - 2 gigabytes.

my code

from free_verify_proxy import VerifyProxyLists
from flask import Flask, request
from color50 import rgb, constants
from fp.fp import FreeProxy
import cv2
import cv2 as cv
from PIL import Image
import numpy as np
from dominant_color_recognizer import ColorAnalyzer, HEXColorModel

app = Flask(__name__)

success_color = rgb(50, 168, 82)
fail_color = rgb(168, 74, 50)
other_color = rgb(168, 135, 50)
print(other_color + 'App version 1.0.1' + constants.RESET)


@app.route("/")
def home_page():
    return "this home page, what did you forget here?"


@app.route("/proxylist", methods=["GET"])
def proxylist():
    try:
        one = request.args["proxy"]
        if one == 'proxy':
            try:
                print(other_color + 'Proxy request, please wait...' + constants.RESET)
                proxy = FreeProxy(anonym=True, google=True).get()
                print(success_color + f'Proxy request, success {proxy}' + constants.RESET)
                return f'Proxy request, success {proxy}'
            except:
                print(fail_color + 'Sorry, Proxy request fail' + constants.RESET)
                return 'Sorry, Proxy request fail'
    except:
        try:
            print(other_color + 'Proxy list request, please wait...' + constants.RESET)
            proxy = VerifyProxyLists().get_verifyProxyLists(number_of_threads=300, timeout=(3, 5))
            print(success_color + f'Proxy list success {proxy}' + constants.RESET)
            return f'Proxy list success {proxy}'
        except:
            print(fail_color + 'Sorry, proxy list fail' + constants.RESET)
            return 'Sorry, proxy list fail'


@app.route("/image", methods=["GET"])
def image():
    if request.method == "GET":
        try:
            captcha = request.args["capa"]
            # color = request.args["color"]

            dominant = ColorAnalyzer(HEXColorModel()).get_dominant_colors(captcha, 4)

            def loadimg(imgname):
                dominant1 = dominant[0].lstrip('#')
                dominant_one = tuple(int(dominant1[i:i + 2], 16) for i in (0, 2, 4))

                img = Image.open(imgname)
                width, height = img.size
                im = np.array(img)
                for x in range(width):
                    for y in range(height):
                        r = im[y, x, 0]
                        g = im[y, x, 1]
                        b = im[y, x, 2]
                        sr = (r, g, b)
                        if sr == dominant_one:
                            im[y, x] = (0, 0, 0, 0)

                img = Image.fromarray(im)
                img.save(captcha)

            img = loadimg(captcha)

            imgs = cv2.imread(captcha, cv2.COLOR_BGR2GRAY)
            cv2.imwrite(captcha, imgs)

            print(success_color + f'success response image color {dominant}' + constants.RESET)
            return f'success response image color {dominant}'
        except:
            print(fail_color + 'Sorry, image color no response' + constants.RESET)
            return 'Sorry, image color no response'


if __name__ == "__main__":
    app.run(host="127.0.0.1", port=8888, debug=False)

After assembling the application, a 40MB file is obtained (this is permissible) and a folder with extensions at 1.8 GB.
Without a folder, the application does not launch and there are extensions in the folder that are not needed. those. it collects everything that is installed (pip list)
I'm writing through Google Translate, sorry if anything is wrong

python 3.10.11
auro py to exe last (just updated today)

Originally created by @Roboxkin on GitHub (Apr 13, 2024). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/478 Originally assigned to: @Roboxkin on GitHub. Hello! I can’t figure out how to make sure that only the necessary extensions are collected in the application. No matter how much I try, I always get 1.5 - 2 gigabytes. my code ```Python from free_verify_proxy import VerifyProxyLists from flask import Flask, request from color50 import rgb, constants from fp.fp import FreeProxy import cv2 import cv2 as cv from PIL import Image import numpy as np from dominant_color_recognizer import ColorAnalyzer, HEXColorModel app = Flask(__name__) success_color = rgb(50, 168, 82) fail_color = rgb(168, 74, 50) other_color = rgb(168, 135, 50) print(other_color + 'App version 1.0.1' + constants.RESET) @app.route("/") def home_page(): return "this home page, what did you forget here?" @app.route("/proxylist", methods=["GET"]) def proxylist(): try: one = request.args["proxy"] if one == 'proxy': try: print(other_color + 'Proxy request, please wait...' + constants.RESET) proxy = FreeProxy(anonym=True, google=True).get() print(success_color + f'Proxy request, success {proxy}' + constants.RESET) return f'Proxy request, success {proxy}' except: print(fail_color + 'Sorry, Proxy request fail' + constants.RESET) return 'Sorry, Proxy request fail' except: try: print(other_color + 'Proxy list request, please wait...' + constants.RESET) proxy = VerifyProxyLists().get_verifyProxyLists(number_of_threads=300, timeout=(3, 5)) print(success_color + f'Proxy list success {proxy}' + constants.RESET) return f'Proxy list success {proxy}' except: print(fail_color + 'Sorry, proxy list fail' + constants.RESET) return 'Sorry, proxy list fail' @app.route("/image", methods=["GET"]) def image(): if request.method == "GET": try: captcha = request.args["capa"] # color = request.args["color"] dominant = ColorAnalyzer(HEXColorModel()).get_dominant_colors(captcha, 4) def loadimg(imgname): dominant1 = dominant[0].lstrip('#') dominant_one = tuple(int(dominant1[i:i + 2], 16) for i in (0, 2, 4)) img = Image.open(imgname) width, height = img.size im = np.array(img) for x in range(width): for y in range(height): r = im[y, x, 0] g = im[y, x, 1] b = im[y, x, 2] sr = (r, g, b) if sr == dominant_one: im[y, x] = (0, 0, 0, 0) img = Image.fromarray(im) img.save(captcha) img = loadimg(captcha) imgs = cv2.imread(captcha, cv2.COLOR_BGR2GRAY) cv2.imwrite(captcha, imgs) print(success_color + f'success response image color {dominant}' + constants.RESET) return f'success response image color {dominant}' except: print(fail_color + 'Sorry, image color no response' + constants.RESET) return 'Sorry, image color no response' if __name__ == "__main__": app.run(host="127.0.0.1", port=8888, debug=False) ``` After assembling the application, a 40MB file is obtained (this is permissible) and a folder with extensions at 1.8 GB. Without a folder, the application does not launch and there are extensions in the folder that are not needed. those. it collects everything that is installed (pip list) I'm writing through Google Translate, sorry if anything is wrong python 3.10.11 auro py to exe last (just updated today)
kerem 2026-02-26 12:21:23 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@github-actions[bot] commented on GitHub (Apr 13, 2024):

👋 Hi, just a reminder that if you haven't read the help post yet, give it a read to see if your issue is covered in it and make sure to follow the debugging section.

Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help post, video or create a new discussion.

<!-- gh-comment-id:2053716082 --> @github-actions[bot] commented on GitHub (Apr 13, 2024): 👋 Hi, just a reminder that if you haven't read [the help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/) yet, give it a read to see if your issue is covered in it and make sure to follow [the debugging section](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#debugging). Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help [post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/), [video](https://youtu.be/OZSZHmWSOeM) or create a [new discussion](https://github.com/brentvollebregt/auto-py-to-exe/discussions).
Author
Owner

@brentvollebregt commented on GitHub (Apr 14, 2024):

I trust you read the help post - when you follow the steps under "The Output Executable is Huge" do you see a size difference?

<!-- gh-comment-id:2054034020 --> @brentvollebregt commented on GitHub (Apr 14, 2024): I trust you read the [help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/) - when you follow the steps under "[The Output Executable is Huge](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#the-output-executable-is-huge)" do you see a size difference?
Author
Owner

@Roboxkin commented on GitHub (Apr 14, 2024):

I trust you read the help post - when you follow the steps under "The Output Executable is Huge" do you see a size difference?

Thank you very much for the answer!
To be honest, I didn’t read it, but I opened the link and immediately understood what the problem was.
Thank you very much for pointing me to the right place and helping me with this issue.

<!-- gh-comment-id:2054108368 --> @Roboxkin commented on GitHub (Apr 14, 2024): > I trust you read the [help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/) - when you follow the steps under "[The Output Executable is Huge](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#the-output-executable-is-huge)" do you see a size difference? Thank you very much for the answer! To be honest, I didn’t read it, but I opened the link and immediately understood what the problem was. Thank you very much for pointing me to the right place and helping me with this issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#375
No description provided.