Sasha Rush commited on
Commit
61353e0
·
1 Parent(s): ed381da
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -442,8 +442,8 @@ def move(board, action, old_pos):
442
  # Finally use %GAME% to inject the game description above.
443
  """)
444
  with gr.Column():
445
- im = gr.Gallery(label="Gallery of the Game")
446
- im.style(preview=True, object_fit="scale-down", columns=1, container=True)
447
  msg_box = gr.HTML(label="", show_label=False)
448
 
449
  output = gr.Code(label="Generating Game Code (You can also edit and rerun)", language="python", value="""def my_example():
@@ -472,7 +472,7 @@ def move(board, action, old_pos):
472
  q = {}
473
  i = 0
474
  count = 0
475
- im_ = [f"tmp.svg"]
476
  state_val = None
477
  yield {im: im_, counter: 0, output: "", msg_box: "", state: state_val}
478
 
@@ -490,7 +490,7 @@ def move(board, action, old_pos):
490
  return
491
  draw_board(q["board"].board.grid, i).render_svg("tmp.svg")
492
  i += 1
493
- im_ = [f"pic{j}.svg" for j in [i-1]]
494
  yield {im: im_, counter: count, output: prefix}
495
  else:
496
  yield {im: im_, counter: count, output: prefix}
@@ -501,7 +501,7 @@ def move(board, action, old_pos):
501
  final_msg = "Didn't make it"
502
  animate(q["board"])
503
 
504
- yield {im: ["movie.gif"], counter: count, output: prefix,
505
  msg_box: final_msg, state: state_val}
506
 
507
 
@@ -524,7 +524,7 @@ def move(board, action, old_pos):
524
  draw_board(q["board"].board.grid, i)
525
  i += 1
526
  animate(q["board"])
527
- out = {im: [f"movie.gif"], msg_box: ""}
528
  print(out)
529
  return out
530
  run_btn.click(run2, inputs={output}, outputs={im, msg_box})
 
442
  # Finally use %GAME% to inject the game description above.
443
  """)
444
  with gr.Column():
445
+ im = gr.Image(label="Gallery of the Game")
446
+ # im.style(preview=True, object_fit="scale-down", columns=1, container=True)
447
  msg_box = gr.HTML(label="", show_label=False)
448
 
449
  output = gr.Code(label="Generating Game Code (You can also edit and rerun)", language="python", value="""def my_example():
 
472
  q = {}
473
  i = 0
474
  count = 0
475
+ im_ = "tmp.svg"
476
  state_val = None
477
  yield {im: im_, counter: 0, output: "", msg_box: "", state: state_val}
478
 
 
490
  return
491
  draw_board(q["board"].board.grid, i).render_svg("tmp.svg")
492
  i += 1
493
+ im_ = f"pic{i-1}.svg"
494
  yield {im: im_, counter: count, output: prefix}
495
  else:
496
  yield {im: im_, counter: count, output: prefix}
 
501
  final_msg = "Didn't make it"
502
  animate(q["board"])
503
 
504
+ yield {im: "movie.gif", counter: count, output: prefix,
505
  msg_box: final_msg, state: state_val}
506
 
507
 
 
524
  draw_board(q["board"].board.grid, i)
525
  i += 1
526
  animate(q["board"])
527
+ out = {im: f"movie.gif", msg_box: ""}
528
  print(out)
529
  return out
530
  run_btn.click(run2, inputs={output}, outputs={im, msg_box})