Spaces:
Sleeping
Sleeping
Update my_model/utilities.py
Browse files- my_model/utilities.py +20 -1
my_model/utilities.py
CHANGED
|
@@ -245,7 +245,7 @@ def is_google_colab():
|
|
| 245 |
return 'COLAB_GPU' in os.environ or 'google.colab' in sys.modules
|
| 246 |
|
| 247 |
|
| 248 |
-
def
|
| 249 |
"""
|
| 250 |
Generates a path for models, images, or data based on the specified type.
|
| 251 |
|
|
@@ -271,6 +271,25 @@ def get_path(name, path_type):
|
|
| 271 |
return full_path
|
| 272 |
|
| 273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
|
| 275 |
if __name__ == "__main__":
|
| 276 |
pass
|
|
|
|
| 245 |
return 'COLAB_GPU' in os.environ or 'google.colab' in sys.modules
|
| 246 |
|
| 247 |
|
| 248 |
+
def get_image_path(name, path_type):
|
| 249 |
"""
|
| 250 |
Generates a path for models, images, or data based on the specified type.
|
| 251 |
|
|
|
|
| 271 |
return full_path
|
| 272 |
|
| 273 |
|
| 274 |
+
def get_model_path(model_name):
|
| 275 |
+
"""
|
| 276 |
+
Get the path to the 'model1' folder.
|
| 277 |
+
|
| 278 |
+
Returns:
|
| 279 |
+
str: Absolute path to the 'model1' folder.
|
| 280 |
+
"""
|
| 281 |
+
# Directory of the current script
|
| 282 |
+
current_script_dir = os.path.dirname(os.path.abspath(__file__))
|
| 283 |
+
|
| 284 |
+
# Directory of the 'my_project' folder (parent of the 'my_model' folder)
|
| 285 |
+
project_dir = os.path.dirname(current_script_dir)
|
| 286 |
+
|
| 287 |
+
# Path to the 'models/{model_name}' folder
|
| 288 |
+
model_path = os.path.join(project_dir, "models", model_name)
|
| 289 |
+
|
| 290 |
+
return model_path
|
| 291 |
+
|
| 292 |
+
|
| 293 |
|
| 294 |
if __name__ == "__main__":
|
| 295 |
pass
|