wookimchye commited on
Commit
1cd7290
·
verified ·
1 Parent(s): 4ce5ba9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -7,7 +7,6 @@ import os
7
 
8
  model_path = "best_int8_openvino_model"
9
 
10
- best_yolo_model = "best.pt" # Trained YOLOv8 detection model
11
 
12
  # Example paths for Gradio
13
  image_examples = [["DurianMangosteen1.jpg"], ["DurianMangosteen2.jpg"]]
@@ -16,11 +15,10 @@ image_examples = [["DurianMangosteen1.jpg"], ["DurianMangosteen2.jpg"]]
16
  def load_model(repo_id):
17
  download_dir = snapshot_download(repo_id) # download the model from the Hugging Face Hub
18
  print(download_dir)
19
- #path = os.path.join(download_dir, "best_int8_openvino_model") # path to the model
20
- #print(path)
21
- #detection_model = YOLO(path, task='detect') # load the model
22
 
23
- detection_model = YOLO(best_yolo_model, task='detect')# load the model
24
  return detection_model
25
 
26
  # Predict the image
@@ -43,7 +41,7 @@ def predict(pilimg):
43
  return out_pilimg
44
 
45
  REPO_ID = "ITI107-2024S2/8035531F" # The repo ID of the model
46
- #detection_model = load_model(REPO_ID)
47
 
48
  title = "Detect Durian and Mangosteen (King and Queen of Fruits) In The Image"
49
  interface = gr.Interface(
 
7
 
8
  model_path = "best_int8_openvino_model"
9
 
 
10
 
11
  # Example paths for Gradio
12
  image_examples = [["DurianMangosteen1.jpg"], ["DurianMangosteen2.jpg"]]
 
15
  def load_model(repo_id):
16
  download_dir = snapshot_download(repo_id) # download the model from the Hugging Face Hub
17
  print(download_dir)
18
+ path = os.path.join(download_dir, "best_int8_openvino_model") # path to the model
19
+ print(path)
20
+ detection_model = YOLO(path, task='detect') # load the model
21
 
 
22
  return detection_model
23
 
24
  # Predict the image
 
41
  return out_pilimg
42
 
43
  REPO_ID = "ITI107-2024S2/8035531F" # The repo ID of the model
44
+ detection_model = load_model(REPO_ID)
45
 
46
  title = "Detect Durian and Mangosteen (King and Queen of Fruits) In The Image"
47
  interface = gr.Interface(