zliang commited on
Commit
19e0bca
·
verified ·
1 Parent(s): 5db9ec4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -6,8 +6,14 @@ import spaces
6
 
7
  # Load the trained model
8
 
9
- model_path = 'best.engine' # Replace with the path to your trained .pt file
10
- model = YOLO(model_path,task="classify")
 
 
 
 
 
 
11
 
12
  # Define the class indices for figures and tables
13
  figure_class_index = 3 # class index for figures
 
6
 
7
  # Load the trained model
8
 
9
+ # Load the YOLOv8 model
10
+ pt_model = YOLO("best.pt")
11
+
12
+ # Export the model to TensorRT format
13
+ pt_model.export(format="engine") # creates 'yolov8n.engine'
14
+
15
+ # Load the exported TensorRT model
16
+ model = YOLO("best.engine")
17
 
18
  # Define the class indices for figures and tables
19
  figure_class_index = 3 # class index for figures