Update app.py
Browse files
app.py
CHANGED
|
@@ -4,17 +4,11 @@
|
|
| 4 |
# https://www.stockfish.online/ (FEN to image)
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
-
|
| 8 |
-
import gradio.utils
|
| 9 |
-
|
| 10 |
-
def dummy_watchfn(*args, **kwargs):
|
| 11 |
-
pass
|
| 12 |
-
|
| 13 |
-
gradio.utils.watchfn_spaces = dummy_watchfn
|
| 14 |
-
|
| 15 |
-
import requests
|
| 16 |
from typing import Optional, List, Dict, Any
|
| 17 |
|
|
|
|
|
|
|
| 18 |
def position_evaluation(fen):
|
| 19 |
"""Chess position evaluation. Get best move with continuation in UCI notation for chess position in FEN.
|
| 20 |
|
|
@@ -41,6 +35,15 @@ def position_evaluation(fen):
|
|
| 41 |
except requests.exceptions.RequestException as e:
|
| 42 |
return None, str(e)
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
mcp = gr.Interface(
|
| 45 |
fn=position_evaluation,
|
| 46 |
inputs = [gr.Textbox(label = "FEN", value = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")],
|
|
|
|
| 4 |
# https://www.stockfish.online/ (FEN to image)
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
+
import gradio.utils, requests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
from typing import Optional, List, Dict, Any
|
| 9 |
|
| 10 |
+
# MCP server functions
|
| 11 |
+
|
| 12 |
def position_evaluation(fen):
|
| 13 |
"""Chess position evaluation. Get best move with continuation in UCI notation for chess position in FEN.
|
| 14 |
|
|
|
|
| 35 |
except requests.exceptions.RequestException as e:
|
| 36 |
return None, str(e)
|
| 37 |
|
| 38 |
+
# Helper functions
|
| 39 |
+
|
| 40 |
+
def watchfn(*args, **kwargs):
|
| 41 |
+
pass
|
| 42 |
+
|
| 43 |
+
gradio.utils.watchfn_spaces = watchfn
|
| 44 |
+
|
| 45 |
+
# Graphical user interface
|
| 46 |
+
|
| 47 |
mcp = gr.Interface(
|
| 48 |
fn=position_evaluation,
|
| 49 |
inputs = [gr.Textbox(label = "FEN", value = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")],
|