mlabonne commited on
Commit
3196bc9
1 Parent(s): 9a7d9cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -200,6 +200,12 @@ def update(model_id_white, model_id_black):
200
  move_number = 1
201
  result = None
202
 
 
 
 
 
 
 
203
  # Time budget
204
  time_budget_white = TIME_BUDGET
205
  time_budget_black = TIME_BUDGET
@@ -242,7 +248,6 @@ def update(model_id_white, model_id_black):
242
  pgn_moves += move_str
243
 
244
  # Render the board to an image
245
-
246
  last_move = board.peek()
247
  svg = chess.svg.board(board=board, arrows=[(last_move.from_square, last_move.to_square)]).encode("utf-8")
248
  png = cairosvg.svg2png(bytestring=svg)
 
200
  move_number = 1
201
  result = None
202
 
203
+ # Render first image
204
+ svg = chess.svg.board(board=board).encode("utf-8")
205
+ png = cairosvg.svg2png(bytestring=svg)
206
+ image = PILImage.open(io.BytesIO(png))
207
+ yield image
208
+
209
  # Time budget
210
  time_budget_white = TIME_BUDGET
211
  time_budget_black = TIME_BUDGET
 
248
  pgn_moves += move_str
249
 
250
  # Render the board to an image
 
251
  last_move = board.peek()
252
  svg = chess.svg.board(board=board, arrows=[(last_move.from_square, last_move.to_square)]).encode("utf-8")
253
  png = cairosvg.svg2png(bytestring=svg)