correctly use spaces.GPU
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import re
|
| 2 |
import chess
|
| 3 |
import gradio as gr
|
|
|
|
| 4 |
from jinja2 import Template
|
| 5 |
from gradio_chessboard import Chessboard
|
| 6 |
import torch
|
|
@@ -102,6 +103,7 @@ Board (Unicode):
|
|
| 102 |
# Model Inference
|
| 103 |
# ============================================================================
|
| 104 |
|
|
|
|
| 105 |
def get_model_move(fen: str) -> tuple[str, str, str]:
|
| 106 |
"""Get model's move for the given position. Returns (uci_move, reasoning, raw_output)."""
|
| 107 |
board = chess.Board(fen)
|
|
@@ -403,7 +405,6 @@ with gr.Blocks(css=CUSTOM_CSS, title="Chess Reasoner", theme=gr.themes.Soft(
|
|
| 403 |
value=chess.STARTING_FEN,
|
| 404 |
label="",
|
| 405 |
interactive=True,
|
| 406 |
-
game_mode=True,
|
| 407 |
)
|
| 408 |
|
| 409 |
# Right: Game controls and info
|
|
|
|
| 1 |
import re
|
| 2 |
import chess
|
| 3 |
import gradio as gr
|
| 4 |
+
import spaces
|
| 5 |
from jinja2 import Template
|
| 6 |
from gradio_chessboard import Chessboard
|
| 7 |
import torch
|
|
|
|
| 103 |
# Model Inference
|
| 104 |
# ============================================================================
|
| 105 |
|
| 106 |
+
@spaces.GPU
|
| 107 |
def get_model_move(fen: str) -> tuple[str, str, str]:
|
| 108 |
"""Get model's move for the given position. Returns (uci_move, reasoning, raw_output)."""
|
| 109 |
board = chess.Board(fen)
|
|
|
|
| 405 |
value=chess.STARTING_FEN,
|
| 406 |
label="",
|
| 407 |
interactive=True,
|
|
|
|
| 408 |
)
|
| 409 |
|
| 410 |
# Right: Game controls and info
|