Spaces:
Sleeping
Sleeping
Commit
·
7f4a7eb
1
Parent(s):
14e36d9
Made change to models path to take them dynamically
Browse files- assets/openings_master.csv +0 -0
- routes/chess_review.py +3 -2
- routes/detection.py +5 -1
- routes/segmentation.py +5 -1
assets/openings_master.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
routes/chess_review.py
CHANGED
@@ -6,6 +6,7 @@ from typing import List, Dict
|
|
6 |
import asyncio
|
7 |
import json
|
8 |
import sys
|
|
|
9 |
|
10 |
if sys.platform == "win32":
|
11 |
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
|
@@ -37,8 +38,8 @@ def load_opening_book(csv_path):
|
|
37 |
return opening_book
|
38 |
|
39 |
|
40 |
-
engine_path =
|
41 |
-
csv_path =
|
42 |
opening_book = load_opening_book(csv_path)
|
43 |
|
44 |
|
|
|
6 |
import asyncio
|
7 |
import json
|
8 |
import sys
|
9 |
+
import os
|
10 |
|
11 |
if sys.platform == "win32":
|
12 |
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
|
|
|
38 |
return opening_book
|
39 |
|
40 |
|
41 |
+
engine_path = os.path.join(os.getcwd(), "models", "stockfish_14_x64_avx2.exe")
|
42 |
+
csv_path = os.path.join(os.getcwd(), "assets", "opening_book.csv")
|
43 |
opening_book = load_opening_book(csv_path)
|
44 |
|
45 |
|
routes/detection.py
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
from ultralytics import YOLO
|
2 |
from PIL import Image
|
3 |
-
|
|
|
|
|
|
|
|
|
4 |
|
5 |
async def detect_pieces(image : Image):
|
6 |
if image is None:
|
|
|
1 |
from ultralytics import YOLO
|
2 |
from PIL import Image
|
3 |
+
import os
|
4 |
+
|
5 |
+
curr = os.getcwd()
|
6 |
+
detect_model_path = os.path.join(curr, 'models', 'chessDetection3d.pt')
|
7 |
+
detect_model = YOLO(detect_model_path)
|
8 |
|
9 |
async def detect_pieces(image : Image):
|
10 |
if image is None:
|
routes/segmentation.py
CHANGED
@@ -1,7 +1,11 @@
|
|
1 |
from ultralytics import YOLO
|
2 |
from PIL import Image
|
|
|
3 |
|
4 |
-
|
|
|
|
|
|
|
5 |
|
6 |
async def segment_chess_board(image : Image):
|
7 |
if image is None:
|
|
|
1 |
from ultralytics import YOLO
|
2 |
from PIL import Image
|
3 |
+
import os
|
4 |
|
5 |
+
curr = os.getcwd()
|
6 |
+
seg_model_path = os.path.join(curr, 'models', 'SegModel (1).pt')
|
7 |
+
|
8 |
+
seg_model = YOLO(seg_model_path)
|
9 |
|
10 |
async def segment_chess_board(image : Image):
|
11 |
if image is None:
|