Spaces:
Running on Zero
Running on Zero
Pierre Chapuis commited on
add Rye config for local development + linting
Browse filesFiles changed (5)
- .gitignore+2
- .python-versionAdded+1
- pyproject.tomlAdded+54
- requirements.lockAdded+231
- src/app.py+17-10
162 unmodified lines163164165162 unmodified lines# and can be added to the global gitignore or merged into this file. For a more nuclear# option (not recommended) you can uncomment the following to ignore the entire idea folder.#.idea/162 unmodified lines163164165166167162 unmodified lines# and can be added to the global gitignore or merged into this file. For a more nuclear# option (not recommended) you can uncomment the following to ignore the entire idea folder.#.idea/requirements-dev.lock
13.12.2123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354[project]name = "enhancer"version = "0.1.0"description = "Finegrain Image Enhancer"authors = [ { name = "Laurent Fainsin", email = "laurent@lagon.tech" }]dependencies = [ "gradio>=4.42.0", "pillow>=10.4.0", "gradio-imageslider>=0.0.20", "pillow-heif>=0.18.0", "refiners @ git+https://github.com/finegrain-ai/refiners", "spaces>=0.29.3", "numpy<2.0.0",]readme = "README.md"requires-python = ">= 3.12, <3.13"
[build-system]requires = ["hatchling"]build-backend = "hatchling.build"
[tool.rye]managed = truedev-dependencies = []
[tool.hatch.metadata]allow-direct-references = true
[tool.hatch.build.targets.wheel]packages = ["src/enhancer"]
[tool.ruff]src = ["src"] # https://docs.astral.sh/ruff/settings/#srcexclude = ["esrgan_model.py"]line-length = 120target-version = "py312"
[tool.ruff.lint]select = [ "E", # pycodestyle errors "W", # pycodestyle warnings "F", # pyflakes "UP", # pyupgrade "A", # flake8-builtins "B", # flake8-bugbear "Q", # flake8-quotes "I", # isort]
[tool.pyright]include = ["src"]exclude = ["**/__pycache__"]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231# generated by rye# use `rye lock` or `rye sync` to update this lockfile## last locked with the following flags:# pre: false# features: []# all-features: false# with-sources: false# generate-hashes: false# universal: false
-e file:.aiofiles==23.2.1 # via gradioannotated-types==0.7.0 # via pydanticanyio==4.4.0 # via gradio # via httpx # via starlettecertifi==2024.8.30 # via httpcore # via httpx # via requestscharset-normalizer==3.3.2 # via requestsclick==8.1.7 # via typer # via uvicorncontourpy==1.3.0 # via matplotlibcycler==0.12.1 # via matplotlibfastapi==0.113.0 # via gradioffmpy==0.4.0 # via gradiofilelock==3.15.4 # via huggingface-hub # via torch # via tritonfonttools==4.53.1 # via matplotlibfsspec==2024.9.0 # via gradio-client # via huggingface-hub # via torchgradio==4.42.0 # via enhancer # via gradio-imageslider # via spacesgradio-client==1.3.0 # via gradiogradio-imageslider==0.0.20 # via enhancerh11==0.14.0 # via httpcore # via uvicornhttpcore==1.0.5 # via httpxhttpx==0.27.2 # via gradio # via gradio-client # via spaceshuggingface-hub==0.24.6 # via gradio # via gradio-clientidna==3.8 # via anyio # via httpx # via requestsimportlib-resources==6.4.4 # via gradiojaxtyping==0.2.34 # via refinersjinja2==3.1.4 # via gradio # via torchkiwisolver==1.4.7 # via matplotlibmarkdown-it-py==3.0.0 # via richmarkupsafe==2.1.5 # via gradio # via jinja2matplotlib==3.9.2 # via gradiomdurl==0.1.2 # via markdown-it-pympmath==1.3.0 # via sympynetworkx==3.3 # via torchnumpy==1.26.4 # via contourpy # via enhancer # via gradio # via matplotlib # via pandas # via refinersnvidia-cublas-cu12==12.1.3.1 # via nvidia-cudnn-cu12 # via nvidia-cusolver-cu12 # via torchnvidia-cuda-cupti-cu12==12.1.105 # via torchnvidia-cuda-nvrtc-cu12==12.1.105 # via torchnvidia-cuda-runtime-cu12==12.1.105 # via torchnvidia-cudnn-cu12==9.1.0.70 # via torchnvidia-cufft-cu12==11.0.2.54 # via torchnvidia-curand-cu12==10.3.2.106 # via torchnvidia-cusolver-cu12==11.4.5.107 # via torchnvidia-cusparse-cu12==12.1.0.106 # via nvidia-cusolver-cu12 # via torchnvidia-nccl-cu12==2.20.5 # via torchnvidia-nvjitlink-cu12==12.6.68 # via nvidia-cusolver-cu12 # via nvidia-cusparse-cu12nvidia-nvtx-cu12==12.1.105 # via torchorjson==3.10.7 # via gradiopackaging==24.1 # via gradio # via gradio-client # via huggingface-hub # via matplotlib # via refiners # via spacespandas==2.2.2 # via gradiopillow==10.4.0 # via enhancer # via gradio # via gradio-imageslider # via matplotlib # via pillow-heif # via refinerspillow-heif==0.18.0 # via enhancerpsutil==5.9.8 # via spacespydantic==2.8.2 # via fastapi # via gradio # via spacespydantic-core==2.20.1 # via pydanticpydub==0.25.1 # via gradiopygments==2.18.0 # via richpyparsing==3.1.4 # via matplotlibpython-dateutil==2.9.0.post0 # via matplotlib # via pandaspython-multipart==0.0.9 # via gradiopytz==2024.1 # via pandaspyyaml==6.0.2 # via gradio # via huggingface-hubrefiners @ git+https://github.com/finegrain-ai/refiners@cf247a1b20609479565618f49bf70c8aa65a7cfd # via enhancerrequests==2.32.3 # via huggingface-hub # via spacesrich==13.8.0 # via typerruff==0.6.4 # via gradiosafetensors==0.4.5 # via refinerssemantic-version==2.10.0 # via gradiosetuptools==74.1.2 # via torchshellingham==1.5.4 # via typersix==1.16.0 # via python-dateutilsniffio==1.3.1 # via anyio # via httpxspaces==0.30.1 # via enhancerstarlette==0.38.4 # via fastapisympy==1.13.2 # via torchtomlkit==0.12.0 # via gradiotorch==2.4.1 # via refinerstqdm==4.66.5 # via huggingface-hubtriton==3.0.0 # via torchtypeguard==2.13.3 # via jaxtypingtyper==0.12.5 # via gradiotyping-extensions==4.12.2 # via fastapi # via gradio # via gradio-client # via huggingface-hub # via pydantic # via pydantic-core # via spaces # via torch # via typertzdata==2024.1 # via pandasurllib3==2.2.2 # via gradio # via requestsuvicorn==0.30.6 # via gradiowebsockets==12.0 # via gradio-client1234567891011129 unmodified lines22232425262728293031323374 unmodified lines10810911011111211311411511611711835 unmodified lines154155156157158159160from pathlib import Pathimport gradio as grimport spacesimport torchfrom gradio_imageslider import ImageSliderfrom huggingface_hub import hf_hub_downloadfrom PIL import Imageimport pillow_heiffrom refiners.fluxion.utils import manual_seedfrom refiners.foundationals.latent_diffusion import Solver, solvers9 unmodified linesImage Enhancer Powered By Refiners</h1><div style="display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 1.25rem; flex-wrap: wrap;"><a href="https://blog.finegrain.ai/posts/reproducing-clarity-upscaler/" target="_blank">[Blog Post]</a><a href="https://github.com/finegrain-ai/refiners" target="_blank">[Refiners]</a><a href="https://finegrain.ai/" target="_blank">[Finegrain]</a><a href="https://huggingface.co/spaces/finegrain/finegrain-object-eraser" target="_blank">[Finegrain Object Eraser]</a><a href="https://huggingface.co/spaces/finegrain/finegrain-object-cutter" target="_blank">[Finegrain Object Cutter]</a></div><p>74 unmodified lines},)LORA_SCALES = {"more_details": 0.5,"sdxl_render": 1.0,}# initialize the enhancer, on the cpuDEVICE_CPU = torch.device("cpu")DTYPE = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float3235 unmodified linestile_size=(tile_height, tile_width),denoise_strength=denoise_strength,num_inference_steps=num_inference_steps,loras_scale=LORA_SCALES,solver_type=solver_type,)1234567891011129 unmodified lines22232425262728293031323334353637383940414243444574 unmodified lines12012112212312412535 unmodified lines161162163164165166167from pathlib import Pathimport gradio as grimport pillow_heifimport spacesimport torchfrom gradio_imageslider import ImageSliderfrom huggingface_hub import hf_hub_downloadfrom PIL import Imagefrom refiners.fluxion.utils import manual_seedfrom refiners.foundationals.latent_diffusion import Solver, solvers9 unmodified linesImage Enhancer Powered By Refiners</h1><div style="display: flex;align-items: center;justify-content: center;gap: 0.5rem;margin-bottom: 0.5rem;font-size: 1.25rem;flex-wrap: wrap;"><a href="https://blog.finegrain.ai/posts/reproducing-clarity-upscaler/" target="_blank">[Blog Post]</a><a href="https://github.com/finegrain-ai/refiners" target="_blank">[Refiners]</a><a href="https://finegrain.ai/" target="_blank">[Finegrain]</a><a href="https://huggingface.co/spaces/finegrain/finegrain-object-eraser" target="_blank">[Finegrain Object Eraser]</a><a href="https://huggingface.co/spaces/finegrain/finegrain-object-cutter" target="_blank">[Finegrain Object Cutter]</a></div><p>74 unmodified lines},)# initialize the enhancer, on the cpuDEVICE_CPU = torch.device("cpu")DTYPE = torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float3235 unmodified linestile_size=(tile_height, tile_width),denoise_strength=denoise_strength,num_inference_steps=num_inference_steps,loras_scale={"more_details": 0.5, "sdxl_render": 1.0},solver_type=solver_type,)
.gitignore+2
.python-versionAdded+1
pyproject.tomlAdded+54
requirements.lockAdded+231
src/app.py+17-10