jrahn commited on
Commit
2d87915
·
verified ·
1 Parent(s): 92e724b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -42,10 +42,8 @@ def btn_play(inp_fen, inp_move, inp_notation, inp_k):
42
  else:
43
  raise ValueError(f'Illegal Move: {str(mv)} @ {board.fen()}')
44
 
45
- with open('board.svg', 'w') as f:
46
- f.write(str(chess.svg.board(board, lastmove=mv)))
47
-
48
- return 'board.svg', board.fen(), ''
49
 
50
  with gr.Blocks() as block:
51
  gr.Markdown(
@@ -76,7 +74,7 @@ with gr.Blocks() as block:
76
  '''
77
  )
78
  with gr.Column():
79
- position_output = gr.Image(label='board')
80
 
81
  load_btn.click(fn=btn_load, inputs=fen, outputs=[position_output, fen, move])
82
  play_btn.click(fn=btn_play, inputs=[fen, move, notation, top_k], outputs=[position_output, fen, move])
 
42
  else:
43
  raise ValueError(f'Illegal Move: {str(mv)} @ {board.fen()}')
44
 
45
+ svg_str = chess.svg.board(board, lastmove=mv)
46
+ return svg_str, board.fen(), ''
 
 
47
 
48
  with gr.Blocks() as block:
49
  gr.Markdown(
 
74
  '''
75
  )
76
  with gr.Column():
77
+ position_output = gr.HTML(label='board')
78
 
79
  load_btn.click(fn=btn_load, inputs=fen, outputs=[position_output, fen, move])
80
  play_btn.click(fn=btn_play, inputs=[fen, move, notation, top_k], outputs=[position_output, fen, move])