Skip to content

Commit

Permalink
Accept a different weight folder for downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Canas committed Jun 15, 2024
1 parent 965e606 commit 3f39fc1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
13 changes: 12 additions & 1 deletion qreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def __init__(
model_size: str = "s",
min_confidence: float = 0.5,
reencode_to: str | tuple[str] | list[str] | None = DEFAULT_REENCODINGS,
weights_folder: str | None = None,
):
"""
This class implements a robust, ML Based QR detector & decoder.
Expand All @@ -94,8 +95,18 @@ def __init__(
specific charset. Recommendations that have been found useful:
- 'shift-jis' for Germanic languages
- 'cp65001' for Asian languages (Thanks to @nguyen-viet-hung for the suggestion)
:param weights_folder: str or None. The folder where the weights of the model will be stored. If None, they will
be stored in the default folder of the qrdet package.
"""
self.detector = QRDetector(model_size=model_size, conf_th=min_confidence)
if weights_folder is None:
self.detector = QRDetector(model_size=model_size, conf_th=min_confidence)
else:
self.detector = QRDetector(
model_size=model_size,
conf_th=min_confidence,
weights_folder=weights_folder,
)

if isinstance(reencode_to, str):
self.reencode_to = (reencode_to,) if reencode_to != "utf-8" else ()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
opencv-python
numpy
pyzbar
qrdet>=2.4
qrdet>=2.5
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="qreader",
version="3.12",
version="3.13",
packages=find_namespace_packages(),
# expose qreader.py as the unique module
py_modules=["qreader"],
Expand All @@ -18,7 +18,7 @@
"numpy",
"opencv-python",
"pyzbar",
"qrdet>=2.1",
"qrdet>=2.5",
],
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down

0 comments on commit 3f39fc1

Please sign in to comment.