Unearthed commited on
Commit
286235a
Β·
verified Β·
1 Parent(s): 5fd41cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -7,16 +7,12 @@ import spaces
7
  import numpy as np
8
  import cv2
9
  import tensorflow as tf
10
- import tf_keras as tf_keras
11
  from PIL import Image
12
  from huggingface_hub import hf_hub_download
13
  from skimage.filters import gabor
14
  from skimage.color import rgb2gray as sk_rgb2gray
15
  from scipy.spatial import cKDTree
16
 
17
- import tf_keras
18
- model = tf_keras.models.load_model(model_path, compile=False)
19
-
20
  # ── Config ───────────────────────────────────────────────────
21
  MODEL_REPO = "Unearthed/artifact-classifier"
22
  MODEL_FILE = "lithic_classifier0601.keras"
@@ -47,9 +43,8 @@ def display_category(cls_name):
47
  # ── Load model at startup ─────────────────────────────────────
48
  print("Loading model...")
49
  model_path = hf_hub_download(repo_id=MODEL_REPO, filename=MODEL_FILE)
50
- import keras
51
- keras.config.enable_unsafe_deserialization()
52
- model = tf.keras.models.load_model(model_path, compile=False)
53
  print("Model ready!")
54
 
55
  # ── Feature extraction ───────────────────────────────────────
 
7
  import numpy as np
8
  import cv2
9
  import tensorflow as tf
 
10
  from PIL import Image
11
  from huggingface_hub import hf_hub_download
12
  from skimage.filters import gabor
13
  from skimage.color import rgb2gray as sk_rgb2gray
14
  from scipy.spatial import cKDTree
15
 
 
 
 
16
  # ── Config ───────────────────────────────────────────────────
17
  MODEL_REPO = "Unearthed/artifact-classifier"
18
  MODEL_FILE = "lithic_classifier0601.keras"
 
43
  # ── Load model at startup ─────────────────────────────────────
44
  print("Loading model...")
45
  model_path = hf_hub_download(repo_id=MODEL_REPO, filename=MODEL_FILE)
46
+ import tf_keras
47
+ model = tf_keras.models.load_model(model_path, compile=False)
 
48
  print("Model ready!")
49
 
50
  # ── Feature extraction ───────────────────────────────────────