Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from ultralyticsplus import YOLO, render_result
|
2 |
+
import cv2
|
3 |
+
|
4 |
+
# load model
|
5 |
+
model = YOLO('foduucom/stockmarket-future-prediction')
|
6 |
+
|
7 |
+
# set model parameters
|
8 |
+
model.overrides['conf'] = 0.25 # NMS confidence threshold
|
9 |
+
model.overrides['iou'] = 0.45 # NMS IoU threshold
|
10 |
+
model.overrides['agnostic_nms'] = False # NMS class-agnostic
|
11 |
+
model.overrides['max_det'] = 1000 # maximum number of detections per image
|
12 |
+
|
13 |
+
# set image
|
14 |
+
image = '/path/to/your/document/images'
|
15 |
+
|
16 |
+
# perform inference
|
17 |
+
results = model.predict(image)
|
18 |
+
|
19 |
+
# observe results
|
20 |
+
print(results[0].boxes)
|
21 |
+
render = render_result(model=model, image=image, result=results[0])
|
22 |
+
render.show()
|