Skip to content

Commit

Permalink
Merge pull request #100 from Kohulan/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Kohulan authored Jun 11, 2024
2 parents 41138be + 6e0e483 commit d990c6f
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 125 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.py text=auto eol=lf
*.bat eol=crlf
58 changes: 29 additions & 29 deletions DECIMER/__init__.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# -*- coding: utf-8 -*-
"""DECIMER V2.6.0 Python Package. ============================
This repository contains DECIMER-V2,Deep lEarning for Chemical ImagE Recognition) project
was launched to address the OCSR problem with the latest computational intelligence methods
to provide an automated open-source software solution.
Typical usage example:
from decimer import predict_SMILES
# Chemical depiction to SMILES translation
image_path = "path/to/imagefile"
SMILES = predict_SMILES(image_path)
print(SMILES)
For comments, bug reports or feature ideas,
please raise a issue on the Github repository.
"""

__version__ = "2.6.0"

__all__ = [
"DECIMER",
]


from .decimer import predict_SMILES
# -*- coding: utf-8 -*-
"""DECIMER V2.6.0 Python Package. ============================
This repository contains DECIMER-V2,Deep lEarning for Chemical ImagE Recognition) project
was launched to address the OCSR problem with the latest computational intelligence methods
to provide an automated open-source software solution.
Typical usage example:
from decimer import predict_SMILES
# Chemical depiction to SMILES translation
image_path = "path/to/imagefile"
SMILES = predict_SMILES(image_path)
print(SMILES)
For comments, bug reports or feature ideas,
please raise a issue on the Github repository.
"""

__version__ = "2.6.0"

__all__ = [
"DECIMER",
]


from .decimer import predict_SMILES
2 changes: 1 addition & 1 deletion DECIMER/decimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def detokenize_output_add_confidence(
decoded_prediction_with_confidence = list(
[(utils.decoder(tok), conf) for tok, conf in prediction_with_confidence_]
)
decoded_prediction_with_confidence.append(prediction_with_confidence_[-1])

return decoded_prediction_with_confidence


Expand Down
9 changes: 4 additions & 5 deletions DECIMER/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ def ensure_models(default_path: str, model_urls: dict) -> dict:
}
for model_name, model_url in model_urls.items():
model_path = os.path.join(default_path, f"{model_name}_model")
if (
os.path.exists(model_path)
and os.stat(os.path.join(model_path, "saved_model.pb")).st_size != model_sizes.get(model_name)
):
print(f'Working with model {model_name}')
if os.path.exists(model_path) and os.stat(
os.path.join(model_path, "saved_model.pb")
).st_size != model_sizes.get(model_name):
print(f"Working with model {model_name}")
shutil.rmtree(model_path)
config.download_trained_weights(model_url, default_path)
elif not os.path.exists(model_path):
Expand Down
70 changes: 35 additions & 35 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
110 changes: 55 additions & 55 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
#!/usr/bin/env python
import platform

import setuptools

if (
platform.processor() == "arm" or platform.processor() == "i386"
) and platform.system() == "Darwin":
tensorflow_os = "tensorflow-macos>=2.10.0,<=2.15.0"
else:
tensorflow_os = "tensorflow>=2.12.0,<=2.15.0"

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="decimer",
version="2.6.0",
author="Kohulan Rajan",
author_email="[email protected]",
maintainer="Kohulan Rajan, Otto Brinkhaus ",
maintainer_email="[email protected], [email protected]",
description="DECIMER 2.6.0: Deep Learning for Chemical Image Recognition using Efficient-Net V2 + Transformer",
long_description=long_description,
long_description_content_type="text/markdown",
entry_points={
"console_scripts": ["decimer = DECIMER.decimer:main"],
},
url="https://github.com/Kohulan/DECIMER-Image_Transformer",
packages=setuptools.find_packages(),
license="MIT",
install_requires=[
tensorflow_os,
"opencv-python",
"pystow",
"pillow-heif",
"efficientnet",
"selfies",
"pyyaml",
],
package_data={"DECIMER": ["repack/*.*", "efficientnetv2/*.*", "Utils/*.*"]},
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.5",
)
#!/usr/bin/env python
import platform

import setuptools

if (
platform.processor() == "arm" or platform.processor() == "i386"
) and platform.system() == "Darwin":
tensorflow_os = "tensorflow-macos>=2.10.0,<=2.15.0"
else:
tensorflow_os = "tensorflow>=2.12.0,<=2.15.0"

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="decimer",
version="2.6.0",
author="Kohulan Rajan",
author_email="[email protected]",
maintainer="Kohulan Rajan, Otto Brinkhaus ",
maintainer_email="[email protected], [email protected]",
description="DECIMER 2.6.0: Deep Learning for Chemical Image Recognition using Efficient-Net V2 + Transformer",
long_description=long_description,
long_description_content_type="text/markdown",
entry_points={
"console_scripts": ["decimer = DECIMER.decimer:main"],
},
url="https://github.com/Kohulan/DECIMER-Image_Transformer",
packages=setuptools.find_packages(),
license="MIT",
install_requires=[
tensorflow_os,
"opencv-python",
"pystow",
"pillow-heif",
"efficientnet",
"selfies",
"pyyaml",
],
package_data={"DECIMER": ["repack/*.*", "efficientnetv2/*.*", "Utils/*.*"]},
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires=">=3.5",
)

0 comments on commit d990c6f

Please sign in to comment.