Spaces:
Sleeping
Sleeping
Update my_model/utilities/gen_utilities.py
Browse files
my_model/utilities/gen_utilities.py
CHANGED
|
@@ -275,26 +275,27 @@ def get_image_path(name, path_type):
|
|
| 275 |
|
| 276 |
def get_model_path(model_name):
|
| 277 |
"""
|
| 278 |
-
Get the path to the specified model
|
| 279 |
|
| 280 |
Args:
|
| 281 |
-
model_name (str):
|
| 282 |
|
| 283 |
Returns:
|
| 284 |
-
str: Absolute path to the specified model
|
| 285 |
"""
|
| 286 |
# Directory of the current script
|
| 287 |
current_script_dir = os.path.dirname(os.path.abspath(__file__))
|
| 288 |
|
| 289 |
-
# Directory of the '
|
| 290 |
-
|
| 291 |
|
| 292 |
# Path to the 'models/{model_name}' folder
|
| 293 |
-
model_path = os.path.join(
|
| 294 |
|
| 295 |
return model_path
|
| 296 |
|
| 297 |
|
|
|
|
| 298 |
def free_gpu_resources():
|
| 299 |
"""
|
| 300 |
Clears GPU memory.
|
|
|
|
| 275 |
|
| 276 |
def get_model_path(model_name):
|
| 277 |
"""
|
| 278 |
+
Get the path to the specified model folder.
|
| 279 |
|
| 280 |
Args:
|
| 281 |
+
model_name (str): Name of the model folder.
|
| 282 |
|
| 283 |
Returns:
|
| 284 |
+
str: Absolute path to the specified model folder.
|
| 285 |
"""
|
| 286 |
# Directory of the current script
|
| 287 |
current_script_dir = os.path.dirname(os.path.abspath(__file__))
|
| 288 |
|
| 289 |
+
# Directory of the 'app' folder (parent of the 'my_model' folder)
|
| 290 |
+
app_dir = os.path.dirname(os.path.dirname(current_script_dir))
|
| 291 |
|
| 292 |
# Path to the 'models/{model_name}' folder
|
| 293 |
+
model_path = os.path.join(app_dir, "models", model_name)
|
| 294 |
|
| 295 |
return model_path
|
| 296 |
|
| 297 |
|
| 298 |
+
|
| 299 |
def free_gpu_resources():
|
| 300 |
"""
|
| 301 |
Clears GPU memory.
|