Spaces:
Runtime error
Runtime error
Sasha Rush
commited on
Commit
·
6c4b976
1
Parent(s):
61353e0
leaderboard
Browse files
app.py
CHANGED
@@ -279,8 +279,7 @@ def example(game, actions):
|
|
279 |
This code makes a few shot example. You don't need to edit it.
|
280 |
"""
|
281 |
return f"""
|
282 |
-
def my_example():
|
283 |
-
b = {repr(game)}
|
284 |
{make_fun(game.board, actions)}
|
285 |
return b
|
286 |
"""
|
@@ -511,6 +510,7 @@ def move(board, action, old_pos):
|
|
511 |
cancel_btn.click(None, cancels=[start_prompt])
|
512 |
def run2(data):
|
513 |
c = data[output]
|
|
|
514 |
print(c)
|
515 |
i = 0
|
516 |
q = {}
|
@@ -520,14 +520,14 @@ def move(board, action, old_pos):
|
|
520 |
ps = prefix.split("\n")
|
521 |
if len(ps) > 3 and not ps[-2].strip().startswith("#") and prefix.endswith("\n"):
|
522 |
print("rendering", prefix)
|
523 |
-
exec(prefix + "\n return b\nq['board'] = my_example()")
|
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})
|
531 |
|
532 |
gr.HTML("""<center><h2>Leaderboard</h2></center>
|
533 |
|
|
|
279 |
This code makes a few shot example. You don't need to edit it.
|
280 |
"""
|
281 |
return f"""
|
282 |
+
def my_example(b):
|
|
|
283 |
{make_fun(game.board, actions)}
|
284 |
return b
|
285 |
"""
|
|
|
510 |
cancel_btn.click(None, cancels=[start_prompt])
|
511 |
def run2(data):
|
512 |
c = data[output]
|
513 |
+
board = eval(data[game_desc]) #games[data[examples]]
|
514 |
print(c)
|
515 |
i = 0
|
516 |
q = {}
|
|
|
520 |
ps = prefix.split("\n")
|
521 |
if len(ps) > 3 and not ps[-2].strip().startswith("#") and prefix.endswith("\n"):
|
522 |
print("rendering", prefix)
|
523 |
+
exec(prefix + f"\n return b\nq['board'] = my_example({repr(board)})")
|
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, game_desc}, outputs={im, msg_box})
|
531 |
|
532 |
gr.HTML("""<center><h2>Leaderboard</h2></center>
|
533 |
|