jrahn commited on
Commit
1e7240f
·
1 Parent(s): 799a947

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -13
app.py CHANGED
@@ -44,10 +44,7 @@ def predict_move(fen, top_k=3):
44
  return p['label']
45
 
46
  def btn_load(inp_fen):
47
- if inp_fen:
48
- board = chess.Board(inp_fen)
49
- else:
50
- board = chess.Board()
51
 
52
  with open('board.svg', 'w') as f:
53
  f.write(str(chess.svg.board(board)))
@@ -84,20 +81,20 @@ with gr.Blocks() as block:
84
  with gr.Row():
85
  load_btn = gr.Button("Load")
86
  play_btn = gr.Button("Play")
 
 
 
 
 
 
 
 
 
87
  with gr.Column():
88
  position_output = gr.Image(label='board')
89
 
90
  load_btn.click(fn=btn_load, inputs=fen, outputs=[position_output, fen])
91
  play_btn.click(fn=btn_play, inputs=[fen, move, notation], outputs=[position_output, fen, move])
92
 
93
- gr.Markdown(
94
- '''
95
- - Click "Load" button to start and reset board.
96
- - Click "Play" button to get Engine move.
97
- - Enter a "human player move" in UCI or SAN notation and click "Play" to move a piece.
98
- - Output "ERROR" generally occurs on illegal moves (Human or Engine).
99
- - Enter "FEN" to start from a custom position.
100
- '''
101
- )
102
 
103
  block.launch()
 
44
  return p['label']
45
 
46
  def btn_load(inp_fen):
47
+ board = chess.Board()
 
 
 
48
 
49
  with open('board.svg', 'w') as f:
50
  f.write(str(chess.svg.board(board)))
 
81
  with gr.Row():
82
  load_btn = gr.Button("Load")
83
  play_btn = gr.Button("Play")
84
+ gr.Markdown(
85
+ '''
86
+ - Click "Load" button to start and reset board.
87
+ - Click "Play" button to get Engine move.
88
+ - Enter a "human player move" in UCI or SAN notation and click "Play" to move a piece.
89
+ - Output "ERROR" generally occurs on illegal moves (Human or Engine).
90
+ - Enter "FEN" to start from a custom position.
91
+ '''
92
+ )
93
  with gr.Column():
94
  position_output = gr.Image(label='board')
95
 
96
  load_btn.click(fn=btn_load, inputs=fen, outputs=[position_output, fen])
97
  play_btn.click(fn=btn_play, inputs=[fen, move, notation], outputs=[position_output, fen, move])
98
 
 
 
 
 
 
 
 
 
 
99
 
100
  block.launch()