Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,6 +56,19 @@ def read_instruction(idx):
|
|
| 56 |
assert len(item) == 1
|
| 57 |
return item[0]['instruction']
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
with gr.Blocks() as demo:
|
| 60 |
gr.Markdown("# Gallery of Generation Results on RISEBench")
|
| 61 |
|
|
@@ -69,6 +82,8 @@ with gr.Blocks() as demo:
|
|
| 69 |
def update_state(problem_index):
|
| 70 |
return problem_index
|
| 71 |
problem_index.submit(fn=update_state, inputs=[problem_index], outputs=[state])
|
|
|
|
|
|
|
| 72 |
|
| 73 |
model_checkboxes = gr.CheckboxGroup(label="Select Models", choices=model_names, value=model_names)
|
| 74 |
|
|
|
|
| 56 |
assert len(item) == 1
|
| 57 |
return item[0]['instruction']
|
| 58 |
|
| 59 |
+
def on_prev(state):
|
| 60 |
+
for i, item in enumerate(data):
|
| 61 |
+
if item['index'] == state:
|
| 62 |
+
break
|
| 63 |
+
return data[i - 1]['index'], data[i - 1]['index']
|
| 64 |
+
|
| 65 |
+
def on_next(state):
|
| 66 |
+
for i, item in enumerate(data):
|
| 67 |
+
if item['index'] == state:
|
| 68 |
+
break
|
| 69 |
+
return data[i + 1]['index'], data[i + 1]['index']
|
| 70 |
+
|
| 71 |
+
|
| 72 |
with gr.Blocks() as demo:
|
| 73 |
gr.Markdown("# Gallery of Generation Results on RISEBench")
|
| 74 |
|
|
|
|
| 82 |
def update_state(problem_index):
|
| 83 |
return problem_index
|
| 84 |
problem_index.submit(fn=update_state, inputs=[problem_index], outputs=[state])
|
| 85 |
+
prev_button.click(fn=on_prev, inputs=[state], outputs=[state, problem_index])
|
| 86 |
+
next_button.click(fn=on_next, inputs=[state], outputs=[state, problem_index])
|
| 87 |
|
| 88 |
model_checkboxes = gr.CheckboxGroup(label="Select Models", choices=model_names, value=model_names)
|
| 89 |
|