shukdev3 commited on
Commit
99c2814
Β·
verified Β·
1 Parent(s): b7c19b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -10,8 +10,10 @@ from flask_cors import CORS
10
 
11
  try:
12
  import numpy as np
13
- except ImportError:
14
- sys.exit("❌ numpy not found. Run: pip install numpy")
 
 
15
 
16
  try:
17
  from PIL import Image, ImageFilter, ImageEnhance, ImageDraw, ImageFont
@@ -559,11 +561,11 @@ def api_save_all():
559
  # It will be loaded automatically when the Space starts.
560
  # ─────────────────────────────────────────────────────────────────────────────
561
 
562
- MODEL_PATH = os.path.join(BASE_DIR, 'shukgen_v3_final.pth')
563
 
564
  def auto_load_model():
565
  if os.path.isfile(MODEL_PATH):
566
- print(f" πŸ” Found shukgen_v3_final.pth β€” loading...")
567
  try:
568
  model, image_size, cfg = load_model(MODEL_PATH, STATE['device'])
569
  STATE['model'] = model
@@ -574,8 +576,8 @@ def auto_load_model():
574
  print(f" ❌ Failed to auto-load model: {e}")
575
  traceback.print_exc()
576
  else:
577
- print(" ⚠️ No shukgen_v3_final.pth found in app directory.")
578
- print(" Upload shukgen_v3_final.pth to the Space repo and restart.")
579
 
580
 
581
  if __name__ == '__main__':
 
10
 
11
  try:
12
  import numpy as np
13
+ print(f" numpy {np.__version__} βœ…")
14
+ except ImportError as e:
15
+ print(f"❌ numpy not found: {e}")
16
+ raise
17
 
18
  try:
19
  from PIL import Image, ImageFilter, ImageEnhance, ImageDraw, ImageFont
 
561
  # It will be loaded automatically when the Space starts.
562
  # ─────────────────────────────────────────────────────────────────────────────
563
 
564
+ MODEL_PATH = os.path.join(BASE_DIR, 'model.pt')
565
 
566
  def auto_load_model():
567
  if os.path.isfile(MODEL_PATH):
568
+ print(f" πŸ” Found model.pt β€” 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 model.pt found in app directory.")
580
+ print(" Upload model.pt to the Space repo and restart.")
581
 
582
 
583
  if __name__ == '__main__':