Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1079,16 +1079,16 @@ u2net_global = None
|
|
| 1079 |
birefnet = None
|
| 1080 |
|
| 1081 |
# Model paths - use absolute paths for Docker
|
| 1082 |
-
reference_model_path = os.path.join(CACHE_DIR, "
|
| 1083 |
u2net_model_path = os.path.join(CACHE_DIR, "u2netp.pth")
|
| 1084 |
|
| 1085 |
# Copy model files to cache if they don't exist - with error handling
|
| 1086 |
def ensure_model_files():
|
| 1087 |
if not os.path.exists(reference_model_path):
|
| 1088 |
-
if os.path.exists("
|
| 1089 |
-
shutil.copy("
|
| 1090 |
else:
|
| 1091 |
-
raise FileNotFoundError("
|
| 1092 |
if not os.path.exists(u2net_model_path):
|
| 1093 |
if os.path.exists("u2netp.pth"):
|
| 1094 |
shutil.copy("u2netp.pth", u2net_model_path)
|
|
|
|
| 1079 |
birefnet = None
|
| 1080 |
|
| 1081 |
# Model paths - use absolute paths for Docker
|
| 1082 |
+
reference_model_path = os.path.join(CACHE_DIR, "best1.pt")
|
| 1083 |
u2net_model_path = os.path.join(CACHE_DIR, "u2netp.pth")
|
| 1084 |
|
| 1085 |
# Copy model files to cache if they don't exist - with error handling
|
| 1086 |
def ensure_model_files():
|
| 1087 |
if not os.path.exists(reference_model_path):
|
| 1088 |
+
if os.path.exists("best1.pt"):
|
| 1089 |
+
shutil.copy("best1.pt", reference_model_path)
|
| 1090 |
else:
|
| 1091 |
+
raise FileNotFoundError("best1.pt model file not found")
|
| 1092 |
if not os.path.exists(u2net_model_path):
|
| 1093 |
if os.path.exists("u2netp.pth"):
|
| 1094 |
shutil.copy("u2netp.pth", u2net_model_path)
|