Huggingface.co server only bug fixes
Browse files"Error
Error: Parameter `logs` is not a valid keyword argument. Please refer to the API for usage."
"
Error
Error: Parameter `__theme` is not a valid keyword argument. Please refer to the API for usage."
- .gitignore +171 -0
- README.md +1 -1
- app.py +61 -16
- images/logo.png +2 -2
- modules/constants.py +24 -0
- modules/version_info.py +14 -14
- requirements.txt +2 -1
- style_20250314.css → style_20250503.css +5 -2
.gitignore
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
################################################################################
|
| 2 |
+
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
|
| 3 |
+
################################################################################
|
| 4 |
+
|
| 5 |
+
# C extensions
|
| 6 |
+
*.so
|
| 7 |
+
|
| 8 |
+
# Distribution / packaging
|
| 9 |
+
.Python
|
| 10 |
+
build/
|
| 11 |
+
develop-eggs/
|
| 12 |
+
dist/
|
| 13 |
+
downloads/
|
| 14 |
+
eggs/
|
| 15 |
+
.eggs/
|
| 16 |
+
lib/
|
| 17 |
+
lib64/
|
| 18 |
+
parts/
|
| 19 |
+
sdist/
|
| 20 |
+
var/
|
| 21 |
+
# wheels/
|
| 22 |
+
share/python-wheels/
|
| 23 |
+
*.egg-info/
|
| 24 |
+
.installed.cfg
|
| 25 |
+
*.egg
|
| 26 |
+
MANIFEST
|
| 27 |
+
|
| 28 |
+
# PyInstaller
|
| 29 |
+
# Usually these files are written by a python script from a template
|
| 30 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 31 |
+
*.manifest
|
| 32 |
+
*.spec
|
| 33 |
+
|
| 34 |
+
# Installer logs
|
| 35 |
+
pip-log.txt
|
| 36 |
+
pip-delete-this-directory.txt
|
| 37 |
+
|
| 38 |
+
# Unit test / coverage reports
|
| 39 |
+
htmlcov/
|
| 40 |
+
.tox/
|
| 41 |
+
.nox/
|
| 42 |
+
.coverage
|
| 43 |
+
.coverage.*
|
| 44 |
+
.cache
|
| 45 |
+
nosetests.xml
|
| 46 |
+
coverage.xml
|
| 47 |
+
*.cover
|
| 48 |
+
*.py,cover
|
| 49 |
+
.hypothesis/
|
| 50 |
+
.pytest_cache/
|
| 51 |
+
cover/
|
| 52 |
+
|
| 53 |
+
# Translations
|
| 54 |
+
*.mo
|
| 55 |
+
*.pot
|
| 56 |
+
|
| 57 |
+
# Django stuff:
|
| 58 |
+
*.log
|
| 59 |
+
local_settings.py
|
| 60 |
+
db.sqlite3
|
| 61 |
+
db.sqlite3-journal
|
| 62 |
+
|
| 63 |
+
# Flask stuff:
|
| 64 |
+
instance/
|
| 65 |
+
.webassets-cache
|
| 66 |
+
|
| 67 |
+
# Scrapy stuff:
|
| 68 |
+
.scrapy
|
| 69 |
+
|
| 70 |
+
# Sphinx documentation
|
| 71 |
+
docs/_build/
|
| 72 |
+
|
| 73 |
+
# PyBuilder
|
| 74 |
+
.pybuilder/
|
| 75 |
+
target/
|
| 76 |
+
|
| 77 |
+
# Jupyter Notebook
|
| 78 |
+
.ipynb_checkpoints
|
| 79 |
+
|
| 80 |
+
# IPython
|
| 81 |
+
profile_default/
|
| 82 |
+
ipython_config.py
|
| 83 |
+
|
| 84 |
+
# pyenv
|
| 85 |
+
# For a library or package, you might want to ignore these files since the code is
|
| 86 |
+
# intended to run in multiple environments; otherwise, check them in:
|
| 87 |
+
# .python-version
|
| 88 |
+
|
| 89 |
+
# pipenv
|
| 90 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 91 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 92 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 93 |
+
# install all needed dependencies.
|
| 94 |
+
#Pipfile.lock
|
| 95 |
+
|
| 96 |
+
# poetry
|
| 97 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
| 98 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
| 99 |
+
# commonly ignored for libraries.
|
| 100 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
| 101 |
+
#poetry.lock
|
| 102 |
+
|
| 103 |
+
# pdm
|
| 104 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
| 105 |
+
#pdm.lock
|
| 106 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
| 107 |
+
# in version control.
|
| 108 |
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
| 109 |
+
.pdm.toml
|
| 110 |
+
.pdm-python
|
| 111 |
+
.pdm-build/
|
| 112 |
+
|
| 113 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
| 114 |
+
__pypackages__/
|
| 115 |
+
|
| 116 |
+
# Celery stuff
|
| 117 |
+
celerybeat-schedule
|
| 118 |
+
celerybeat.pid
|
| 119 |
+
|
| 120 |
+
# SageMath parsed files
|
| 121 |
+
*.sage.py
|
| 122 |
+
|
| 123 |
+
# Environments
|
| 124 |
+
.env
|
| 125 |
+
.venv
|
| 126 |
+
env/
|
| 127 |
+
venv/
|
| 128 |
+
ENV/
|
| 129 |
+
env.bak/
|
| 130 |
+
venv.bak/
|
| 131 |
+
|
| 132 |
+
# Spyder project settings
|
| 133 |
+
.spyderproject
|
| 134 |
+
.spyproject
|
| 135 |
+
|
| 136 |
+
# Rope project settings
|
| 137 |
+
.ropeproject
|
| 138 |
+
|
| 139 |
+
# mkdocs documentation
|
| 140 |
+
/site
|
| 141 |
+
|
| 142 |
+
# mypy
|
| 143 |
+
.mypy_cache/
|
| 144 |
+
.dmypy.json
|
| 145 |
+
dmypy.json
|
| 146 |
+
|
| 147 |
+
# Pyre type checker
|
| 148 |
+
.pyre/
|
| 149 |
+
|
| 150 |
+
# pytype static type analyzer
|
| 151 |
+
.pytype/
|
| 152 |
+
|
| 153 |
+
# Cython debug symbols
|
| 154 |
+
cython_debug/
|
| 155 |
+
|
| 156 |
+
# PyCharm
|
| 157 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
| 158 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
| 159 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 160 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 161 |
+
#.idea/
|
| 162 |
+
/.vs
|
| 163 |
+
/.vs
|
| 164 |
+
/src/__pycache__
|
| 165 |
+
/utils/__pycache__
|
| 166 |
+
**/__pycache__
|
| 167 |
+
/temp_models
|
| 168 |
+
/.vscode/settings.json
|
| 169 |
+
**/*.pyc
|
| 170 |
+
**/__pycache__/
|
| 171 |
+
/utils/tmp
|
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🐢
|
|
| 4 |
colorFrom: yellow
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 5.
|
| 8 |
python_version: 3.12.8
|
| 9 |
license: apache-2.0
|
| 10 |
app_file: app.py
|
|
|
|
| 4 |
colorFrom: yellow
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.27.1
|
| 8 |
python_version: 3.12.8
|
| 9 |
license: apache-2.0
|
| 10 |
app_file: app.py
|
app.py
CHANGED
|
@@ -1,7 +1,11 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
|
|
|
| 3 |
import modules.version_info as version_info
|
| 4 |
|
|
|
|
|
|
|
|
|
|
| 5 |
def getVersions():
|
| 6 |
#return html_versions
|
| 7 |
return version_info.versions_html()
|
|
@@ -22,32 +26,66 @@ def load_data(query_params, model_3d, image_slider):
|
|
| 22 |
model_url = "models/beeuty_545jlbh1_300dpi.glb"
|
| 23 |
return model_url, slider_images
|
| 24 |
|
| 25 |
-
def process_upload(files):
|
| 26 |
"""
|
| 27 |
Process uploaded files and assign them to the appropriate component based on file extension.
|
|
|
|
| 28 |
Files with extensions in [".glb", ".gltf", ".obj", ".ply"] are sent to the Model3D component.
|
| 29 |
Files with extensions in [".png", ".jpg", ".jpeg"] are sent to the ImageSlider component.
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
"""
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
| 35 |
if not isinstance(files, list):
|
| 36 |
files = [files]
|
|
|
|
| 37 |
for f in files:
|
| 38 |
# f can be a file path (string) or an object with attribute `name`
|
| 39 |
file_name = f.name if hasattr(f, "name") else f
|
| 40 |
ext = os.path.splitext(file_name)[1].lower()
|
|
|
|
| 41 |
if ext in [".glb", ".gltf", ".obj", ".ply"]:
|
| 42 |
-
if
|
| 43 |
-
|
| 44 |
elif ext in [".png", ".jpg", ".jpeg"]:
|
| 45 |
-
if len(
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
gr.set_static_paths(paths=["images/", "models/", "assets/"])
|
| 50 |
-
with gr.Blocks(css_paths="
|
| 51 |
gr.Markdown("# 3D Model Viewer")
|
| 52 |
|
| 53 |
with gr.Row():
|
|
@@ -57,12 +95,14 @@ with gr.Blocks(css_paths="style_20250314.css", title="3D viewer", theme='Surn/Be
|
|
| 57 |
value=None,
|
| 58 |
height=480,
|
| 59 |
elem_id="model_3d", key="model_3d"
|
|
|
|
| 60 |
)
|
| 61 |
image_slider = gr.ImageSlider(
|
| 62 |
label="2D Images",
|
| 63 |
value=None,
|
| 64 |
height=480,
|
| 65 |
-
elem_id="image_slider", key="image_slider"
|
|
|
|
| 66 |
)
|
| 67 |
|
| 68 |
with gr.Row():
|
|
@@ -82,18 +122,23 @@ with gr.Blocks(css_paths="style_20250314.css", title="3D viewer", theme='Surn/Be
|
|
| 82 |
js="""() => {
|
| 83 |
const params = Object.fromEntries(new URLSearchParams(window.location.search));
|
| 84 |
return params;
|
| 85 |
-
}"""
|
|
|
|
| 86 |
)
|
| 87 |
|
| 88 |
# Process uploaded files to update the Model3D or ImageSlider component.
|
| 89 |
upload_btn.upload(
|
| 90 |
process_upload,
|
| 91 |
-
inputs=upload_btn,
|
| 92 |
-
outputs=[model_3d, image_slider]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
)
|
| 94 |
|
| 95 |
if __name__ == "__main__":
|
| 96 |
viewer3d.launch(
|
| 97 |
allowed_paths=["assets", "assets/", "./assets", "images/", "./images", 'e:/TMP', 'models/'],
|
| 98 |
-
favicon_path="./assets/favicon.ico", show_api=
|
| 99 |
)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
+
import modules.constants as constants
|
| 4 |
import modules.version_info as version_info
|
| 5 |
|
| 6 |
+
|
| 7 |
+
user_dir = constants.TMPDIR
|
| 8 |
+
|
| 9 |
def getVersions():
|
| 10 |
#return html_versions
|
| 11 |
return version_info.versions_html()
|
|
|
|
| 26 |
model_url = "models/beeuty_545jlbh1_300dpi.glb"
|
| 27 |
return model_url, slider_images
|
| 28 |
|
| 29 |
+
def process_upload(files, current_model, current_images):
|
| 30 |
"""
|
| 31 |
Process uploaded files and assign them to the appropriate component based on file extension.
|
| 32 |
+
|
| 33 |
Files with extensions in [".glb", ".gltf", ".obj", ".ply"] are sent to the Model3D component.
|
| 34 |
Files with extensions in [".png", ".jpg", ".jpeg"] are sent to the ImageSlider component.
|
| 35 |
+
|
| 36 |
+
The function merges the uploaded files with current data. If a file for a component is not
|
| 37 |
+
provided in the upload (i.e. not exactly 1 model file or not exactly 2 image files), then the
|
| 38 |
+
original data will be retained for that component. If an upload is provided, it will replace
|
| 39 |
+
the corresponding value.
|
| 40 |
+
|
| 41 |
+
For the ImageSlider, if a single image is provided in the upload, it will update only the first
|
| 42 |
+
image slot, leaving the second slot unchanged.
|
| 43 |
"""
|
| 44 |
+
extracted_model = None
|
| 45 |
+
extracted_images = []
|
| 46 |
+
|
| 47 |
+
# Ensure files is a list.
|
| 48 |
if not isinstance(files, list):
|
| 49 |
files = [files]
|
| 50 |
+
|
| 51 |
for f in files:
|
| 52 |
# f can be a file path (string) or an object with attribute `name`
|
| 53 |
file_name = f.name if hasattr(f, "name") else f
|
| 54 |
ext = os.path.splitext(file_name)[1].lower()
|
| 55 |
+
|
| 56 |
if ext in [".glb", ".gltf", ".obj", ".ply"]:
|
| 57 |
+
if extracted_model is None:
|
| 58 |
+
extracted_model = file_name
|
| 59 |
elif ext in [".png", ".jpg", ".jpeg"]:
|
| 60 |
+
if len(extracted_images) < 2:
|
| 61 |
+
extracted_images.append(file_name)
|
| 62 |
+
|
| 63 |
+
# Merge results with current data.
|
| 64 |
+
updated_model = extracted_model if extracted_model is not None else current_model
|
| 65 |
+
|
| 66 |
+
# Convert current_images if it's a tuple or a single item.
|
| 67 |
+
if isinstance(current_images, tuple):
|
| 68 |
+
current_images = list(current_images)
|
| 69 |
+
elif current_images is not None and not isinstance(current_images, list):
|
| 70 |
+
current_images = [current_images]
|
| 71 |
+
|
| 72 |
+
# For the image slider, we expect a list of exactly 2 images.
|
| 73 |
+
# Start with current images (or use defaults if None).
|
| 74 |
+
if current_images is None or not isinstance(current_images, list):
|
| 75 |
+
new_images = [None, None]
|
| 76 |
+
else:
|
| 77 |
+
new_images = current_images + [None] * (2 - len(current_images))
|
| 78 |
+
new_images = new_images[:2]
|
| 79 |
+
|
| 80 |
+
# If at least one image is uploaded, update the corresponding slot(s).
|
| 81 |
+
for i in range(len(extracted_images)):
|
| 82 |
+
if i < 2:
|
| 83 |
+
new_images[i] = extracted_images[i]
|
| 84 |
+
|
| 85 |
+
return updated_model, new_images
|
| 86 |
|
| 87 |
gr.set_static_paths(paths=["images/", "models/", "assets/"])
|
| 88 |
+
with gr.Blocks(css_paths="style_20250503.css", title="3D viewer", theme='Surn/beeuty',delete_cache=(21600,86400), fill_width=True) as viewer3d:
|
| 89 |
gr.Markdown("# 3D Model Viewer")
|
| 90 |
|
| 91 |
with gr.Row():
|
|
|
|
| 95 |
value=None,
|
| 96 |
height=480,
|
| 97 |
elem_id="model_3d", key="model_3d"
|
| 98 |
+
|
| 99 |
)
|
| 100 |
image_slider = gr.ImageSlider(
|
| 101 |
label="2D Images",
|
| 102 |
value=None,
|
| 103 |
height=480,
|
| 104 |
+
elem_id="image_slider", key="image_slider",
|
| 105 |
+
type="filepath"
|
| 106 |
)
|
| 107 |
|
| 108 |
with gr.Row():
|
|
|
|
| 122 |
js="""() => {
|
| 123 |
const params = Object.fromEntries(new URLSearchParams(window.location.search));
|
| 124 |
return params;
|
| 125 |
+
}""",
|
| 126 |
+
scroll_to_output=True
|
| 127 |
)
|
| 128 |
|
| 129 |
# Process uploaded files to update the Model3D or ImageSlider component.
|
| 130 |
upload_btn.upload(
|
| 131 |
process_upload,
|
| 132 |
+
inputs=[upload_btn, model_3d, image_slider],
|
| 133 |
+
outputs=[model_3d, image_slider],
|
| 134 |
+
scroll_to_output=True,
|
| 135 |
+
api_name="process_upload",
|
| 136 |
+
show_progress=True
|
| 137 |
+
|
| 138 |
)
|
| 139 |
|
| 140 |
if __name__ == "__main__":
|
| 141 |
viewer3d.launch(
|
| 142 |
allowed_paths=["assets", "assets/", "./assets", "images/", "./images", 'e:/TMP', 'models/'],
|
| 143 |
+
favicon_path="./assets/favicon.ico", show_api=True, strict_cors=False
|
| 144 |
)
|
images/logo.png
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
modules/constants.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# modules/constants.py
|
| 2 |
+
# constants.py contains all the constants used in the project
|
| 3 |
+
import os
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from dotenv import load_dotenv
|
| 6 |
+
|
| 7 |
+
# Load environment variables from .env file
|
| 8 |
+
dotenv_path = Path(__file__).parent.parent / '.env'
|
| 9 |
+
load_dotenv(dotenv_path)
|
| 10 |
+
|
| 11 |
+
IS_SHARED_SPACE = "Surn/3D-Viewer" in os.environ.get('SPACE_ID', '')
|
| 12 |
+
|
| 13 |
+
HF_API_TOKEN = os.getenv("HF_TOKEN")
|
| 14 |
+
if not HF_API_TOKEN:
|
| 15 |
+
raise ValueError("HF_TOKEN is not set. Please check your .env file.")
|
| 16 |
+
try:
|
| 17 |
+
if os.environ['TMPDIR']:
|
| 18 |
+
TMPDIR = os.environ['TMPDIR']
|
| 19 |
+
else:
|
| 20 |
+
TMPDIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
|
| 21 |
+
except:
|
| 22 |
+
TMPDIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
|
| 23 |
+
|
| 24 |
+
os.makedirs(TMPDIR, exist_ok=True)
|
modules/version_info.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
import subprocess
|
| 4 |
import os
|
| 5 |
import sys
|
| 6 |
-
import gc
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
git = os.environ.get('GIT', "git")
|
|
@@ -63,19 +63,19 @@ def get_torch_info():
|
|
| 63 |
del torch_version_, version, cuda, backends
|
| 64 |
return "<none>"
|
| 65 |
|
| 66 |
-
def release_torch_resources():
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
|
| 80 |
|
| 81 |
def initialize_cuda():
|
|
|
|
| 3 |
import subprocess
|
| 4 |
import os
|
| 5 |
import sys
|
| 6 |
+
# import gc
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
git = os.environ.get('GIT', "git")
|
|
|
|
| 63 |
del torch_version_, version, cuda, backends
|
| 64 |
return "<none>"
|
| 65 |
|
| 66 |
+
# def release_torch_resources():
|
| 67 |
+
# from torch import cuda
|
| 68 |
+
# if cuda.is_available():
|
| 69 |
+
# # Clear the CUDA cache
|
| 70 |
+
# cuda.empty_cache()
|
| 71 |
+
# cuda.ipc_collect()
|
| 72 |
+
# # Delete any objects that are using GPU memory
|
| 73 |
+
# #for obj in gc.get_objects():
|
| 74 |
+
# # if is_tensor(obj) or (hasattr(obj, 'data') and is_tensor(obj.data)):
|
| 75 |
+
# # del obj
|
| 76 |
+
# # Run garbage collection
|
| 77 |
+
# del cuda
|
| 78 |
+
# gc.collect()
|
| 79 |
|
| 80 |
|
| 81 |
def initialize_cuda():
|
requirements.txt
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
-
torch
|
| 2 |
transformers
|
|
|
|
|
|
| 1 |
+
torch --extra-index-url https://download.pytorch.org/whl/cu124
|
| 2 |
transformers
|
| 3 |
+
python-dotenv
|
style_20250314.css → style_20250503.css
RENAMED
|
@@ -21,7 +21,7 @@
|
|
| 21 |
/*background-color: rgba(242, 218, 163, 0.62);*/
|
| 22 |
}
|
| 23 |
|
| 24 |
-
.dark .gradio-container.gradio-container-5-
|
| 25 |
/*background-color: rgba(41, 18, 5, 0.38) !important;*/
|
| 26 |
}
|
| 27 |
.toast-body.info {
|
|
@@ -102,6 +102,9 @@ a {
|
|
| 102 |
position: relative !important;
|
| 103 |
}
|
| 104 |
|
|
|
|
|
|
|
|
|
|
| 105 |
.gradio-container::before {
|
| 106 |
content: ' ';
|
| 107 |
display: block;
|
|
@@ -112,7 +115,7 @@ a {
|
|
| 112 |
height: 100%;
|
| 113 |
opacity: 0.25;
|
| 114 |
background-image: url('gradio_api/file=./images/logo.png');
|
| 115 |
-
background-repeat:
|
| 116 |
background-position: 50% 0;
|
| 117 |
background-size: contain;
|
| 118 |
background-color: rgba(0,0,0,0.9);
|
|
|
|
| 21 |
/*background-color: rgba(242, 218, 163, 0.62);*/
|
| 22 |
}
|
| 23 |
|
| 24 |
+
.dark .gradio-container.gradio-container-5-29-0 .contain .intro .prose {
|
| 25 |
/*background-color: rgba(41, 18, 5, 0.38) !important;*/
|
| 26 |
}
|
| 27 |
.toast-body.info {
|
|
|
|
| 102 |
position: relative !important;
|
| 103 |
}
|
| 104 |
|
| 105 |
+
.gradio-container .image-container .preview.svelte-k63p1v {
|
| 106 |
+
object-fit: cover;
|
| 107 |
+
}
|
| 108 |
.gradio-container::before {
|
| 109 |
content: ' ';
|
| 110 |
display: block;
|
|
|
|
| 115 |
height: 100%;
|
| 116 |
opacity: 0.25;
|
| 117 |
background-image: url('gradio_api/file=./images/logo.png');
|
| 118 |
+
background-repeat:repeat ;
|
| 119 |
background-position: 50% 0;
|
| 120 |
background-size: contain;
|
| 121 |
background-color: rgba(0,0,0,0.9);
|