ChessGPT_Stockfish / app.StockfishGradiopy.py
nakas's picture
gp3 with stocky
5bdee70
raw
history blame contribute delete
938 Bytes
###from stockfish import Stockfish
###stockfish = Stockfish(path="/stockfish/stockfish-9-64")
import gradio as gr
import os
import chess
import chess.engine
import stat
def eval(fenstring):
output = ""
os.chmod("./stockfish_14_x64_popcnt",0o0777)
engine = chess.engine.SimpleEngine.popen_uci("./stockfish_14_x64_popcnt")
# Score: PovScore(Cp(+20), WHITE)
board = chess.Board(fenstring)
info = engine.analyse(board, chess.engine.Limit(depth=20),multipv=3)
# Score: PovScore(Mate(+1), WHITE)
engine.quit()
return info
iface = gr.Interface(fn=eval, title="Stockfish chessboard eval",
description="Stockfish 14 chess evaluation using pychess engine component. Enter in fen string to get the board eval and the 3 best moves with continuations\
Stockfish 15 would not execute in huggingface due to glibc", inputs="text", outputs="text")
iface.launch()