Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,20 +8,17 @@ from pathlib import Path
|
|
8 |
|
9 |
detection_model = AutoDetectionModel.from_pretrained(
|
10 |
model_type='ultralytics',
|
11 |
-
model_path="
|
12 |
confidence_threshold=0.01,
|
13 |
device="cpu" # Change to 'cuda:0' if you have a GPU
|
14 |
)
|
15 |
|
16 |
-
OUTPUT_PATH = "/
|
17 |
-
TEMP_PNG_PATH = "/
|
18 |
|
19 |
def run_inference(image):
|
20 |
-
input_path = "/workspace/input_image.jpg"
|
21 |
-
cv2.imwrite(input_path, cv2.cvtColor(image, cv2.COLOR_RGB2BGR))
|
22 |
-
|
23 |
result = get_sliced_prediction(
|
24 |
-
|
25 |
detection_model,
|
26 |
slice_height=256,
|
27 |
slice_width=256,
|
|
|
8 |
|
9 |
detection_model = AutoDetectionModel.from_pretrained(
|
10 |
model_type='ultralytics',
|
11 |
+
model_path="./DDR.pt", # Replace with your model path
|
12 |
confidence_threshold=0.01,
|
13 |
device="cpu" # Change to 'cuda:0' if you have a GPU
|
14 |
)
|
15 |
|
16 |
+
OUTPUT_PATH = "./outputs/pred_image.jpg"
|
17 |
+
TEMP_PNG_PATH = "./outputs/pred_image.png"
|
18 |
|
19 |
def run_inference(image):
|
|
|
|
|
|
|
20 |
result = get_sliced_prediction(
|
21 |
+
image,
|
22 |
detection_model,
|
23 |
slice_height=256,
|
24 |
slice_width=256,
|