Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
"""
|
| 2 |
ShukGEN v3 β Flask Backend Server (Hugging Face Spaces Edition)
|
| 3 |
Serves both the UI (index.html) and the API on port 7860.
|
| 4 |
-
Model is auto-loaded from
|
| 5 |
"""
|
| 6 |
|
| 7 |
import io, base64, os, sys, traceback, threading, time, math
|
|
@@ -557,15 +557,15 @@ def api_save_all():
|
|
| 557 |
|
| 558 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 559 |
# AUTO-LOAD MODEL ON STARTUP
|
| 560 |
-
# Place your model file as
|
| 561 |
# It will be loaded automatically when the Space starts.
|
| 562 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 563 |
|
| 564 |
-
MODEL_PATH = os.path.join(BASE_DIR, '
|
| 565 |
|
| 566 |
def auto_load_model():
|
| 567 |
if os.path.isfile(MODEL_PATH):
|
| 568 |
-
print(f" π Found
|
| 569 |
try:
|
| 570 |
model, image_size, cfg = load_model(MODEL_PATH, STATE['device'])
|
| 571 |
STATE['model'] = model
|
|
@@ -576,8 +576,8 @@ def auto_load_model():
|
|
| 576 |
print(f" β Failed to auto-load model: {e}")
|
| 577 |
traceback.print_exc()
|
| 578 |
else:
|
| 579 |
-
print(" β οΈ No
|
| 580 |
-
print(" Upload
|
| 581 |
|
| 582 |
|
| 583 |
if __name__ == '__main__':
|
|
|
|
| 1 |
"""
|
| 2 |
ShukGEN v3 β Flask Backend Server (Hugging Face Spaces Edition)
|
| 3 |
Serves both the UI (index.html) and the API on port 7860.
|
| 4 |
+
Model is auto-loaded from shukgen_v3_final.pth in the same directory at startup.
|
| 5 |
"""
|
| 6 |
|
| 7 |
import io, base64, os, sys, traceback, threading, time, math
|
|
|
|
| 557 |
|
| 558 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 559 |
# AUTO-LOAD MODEL ON STARTUP
|
| 560 |
+
# Place your model file as shukgen_v3_final.pth in the same directory as this script.
|
| 561 |
# It will be loaded automatically when the Space starts.
|
| 562 |
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 563 |
|
| 564 |
+
MODEL_PATH = os.path.join(BASE_DIR, 'shukgen_v3_final.pth')
|
| 565 |
|
| 566 |
def auto_load_model():
|
| 567 |
if os.path.isfile(MODEL_PATH):
|
| 568 |
+
print(f" π Found shukgen_v3_final.pth β loading...")
|
| 569 |
try:
|
| 570 |
model, image_size, cfg = load_model(MODEL_PATH, STATE['device'])
|
| 571 |
STATE['model'] = model
|
|
|
|
| 576 |
print(f" β Failed to auto-load model: {e}")
|
| 577 |
traceback.print_exc()
|
| 578 |
else:
|
| 579 |
+
print(" β οΈ No shukgen_v3_final.pth found in app directory.")
|
| 580 |
+
print(" Upload shukgen_v3_final.pth to the Space repo and restart.")
|
| 581 |
|
| 582 |
|
| 583 |
if __name__ == '__main__':
|