Spaces:
Running
Running
Commit
·
07c5183
1
Parent(s):
17438aa
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,8 +5,7 @@ from fastapi.templating import Jinja2Templates
|
|
| 5 |
import chess
|
| 6 |
from datasets import load_dataset
|
| 7 |
|
| 8 |
-
|
| 9 |
-
index, metadata = load_index('puzzles_position_index.pkl')
|
| 10 |
|
| 11 |
def board_to_tokens(board):
|
| 12 |
return [(board.piece_at(sq).symbol(), chess.square_name(sq)) for sq in chess.SQUARES if board.piece_at(sq)]
|
|
@@ -37,6 +36,8 @@ def query_positions(index, metadata, query_tokens):
|
|
| 37 |
|
| 38 |
return [(pos_id, metadata[pos_id]) for pos_id in result]
|
| 39 |
|
|
|
|
|
|
|
| 40 |
app = FastAPI()
|
| 41 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 42 |
templates = Jinja2Templates(directory="templates")
|
|
|
|
| 5 |
import chess
|
| 6 |
from datasets import load_dataset
|
| 7 |
|
| 8 |
+
|
|
|
|
| 9 |
|
| 10 |
def board_to_tokens(board):
|
| 11 |
return [(board.piece_at(sq).symbol(), chess.square_name(sq)) for sq in chess.SQUARES if board.piece_at(sq)]
|
|
|
|
| 36 |
|
| 37 |
return [(pos_id, metadata[pos_id]) for pos_id in result]
|
| 38 |
|
| 39 |
+
dset = load_dataset("Lichess/chess-puzzles", split="train")
|
| 40 |
+
index, metadata = load_index('puzzles_position_index.pkl')
|
| 41 |
app = FastAPI()
|
| 42 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 43 |
templates = Jinja2Templates(directory="templates")
|