Narendra9009 commited on
Commit
7f4a7eb
·
1 Parent(s): 14e36d9

Made change to models path to take them dynamically

Browse files
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 = r"D:\venv\chess-vision\code\stockfish-windows-x86-64-avx2\stockfish\stockfish-windows-x86-64-avx2.exe"
41
- csv_path = r"D:\venv\chess-vision\code\openings_master.csv"
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
- detect_model = YOLO(r'D:\venv\chess-vision\models\chessDetection3d.pt')
 
 
 
 
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
- seg_model = YOLO(r'D:\venv\chess-vision\models\SegModel (1).pt')
 
 
 
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: