Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,9 +1,18 @@
|
|
| 1 |
"""Chart Pattern Detection API — YOLOv8 on HuggingFace Spaces"""
|
| 2 |
import gradio as gr
|
| 3 |
-
|
| 4 |
-
from PIL import Image
|
| 5 |
import json
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
model = YOLO("foduucom/stockmarket-pattern-detection-yolov8")
|
| 8 |
model.overrides["conf"] = 0.25
|
| 9 |
model.overrides["iou"] = 0.45
|
|
|
|
| 1 |
"""Chart Pattern Detection API — YOLOv8 on HuggingFace Spaces"""
|
| 2 |
import gradio as gr
|
| 3 |
+
import torch
|
|
|
|
| 4 |
import json
|
| 5 |
|
| 6 |
+
# Fix PyTorch 2.6+ weights_only default change
|
| 7 |
+
_original_load = torch.load
|
| 8 |
+
def _patched_load(*args, **kwargs):
|
| 9 |
+
if "weights_only" not in kwargs:
|
| 10 |
+
kwargs["weights_only"] = False
|
| 11 |
+
return _original_load(*args, **kwargs)
|
| 12 |
+
torch.load = _patched_load
|
| 13 |
+
|
| 14 |
+
from ultralyticsplus import YOLO
|
| 15 |
+
|
| 16 |
model = YOLO("foduucom/stockmarket-pattern-detection-yolov8")
|
| 17 |
model.overrides["conf"] = 0.25
|
| 18 |
model.overrides["iou"] = 0.45
|