prshntdxt commited on
Commit
6a49d1a
·
verified ·
1 Parent(s): 450db69

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -3
main.py CHANGED
@@ -1,5 +1,5 @@
1
  # main.py
2
-
3
  from fastapi import FastAPI, HTTPException, Request
4
  from fastapi.responses import JSONResponse, HTMLResponse
5
  import tensorflow as tf
@@ -207,14 +207,21 @@ def predict(payload: PredictRequest):
207
  # ---------------------------------------------------------------------
208
  # Run model (raw confidence)
209
  # ---------------------------------------------------------------------
210
- MODEL_PATH = "/app/models/Forest_Segmentation_Best.keras"
211
-
 
 
 
 
 
 
212
  model = tf.keras.models.load_model(
213
  MODEL_PATH,
214
  compile=False
215
  )
216
 
217
 
 
218
  confidence_map = model.predict(
219
  input_tensor, verbose=0
220
  )[0, :, :, 0]
 
1
  # main.py
2
+ from huggingface_hub import hf_hub_download
3
  from fastapi import FastAPI, HTTPException, Request
4
  from fastapi.responses import JSONResponse, HTMLResponse
5
  import tensorflow as tf
 
207
  # ---------------------------------------------------------------------
208
  # Run model (raw confidence)
209
  # ---------------------------------------------------------------------
210
+ MODEL_REPO = "prshntdxt/Forest_Segmentation_Best"
211
+ MODEL_FILE = "Forest_Segmentation_Best.keras"
212
+
213
+ MODEL_PATH = hf_hub_download(
214
+ repo_id=MODEL_REPO,
215
+ filename=MODEL_FILE,
216
+ )
217
+
218
  model = tf.keras.models.load_model(
219
  MODEL_PATH,
220
  compile=False
221
  )
222
 
223
 
224
+
225
  confidence_map = model.predict(
226
  input_tensor, verbose=0
227
  )[0, :, :, 0]