yuchenlin commited on
Commit
645b85b
β€’
1 Parent(s): eaea101
Files changed (2) hide show
  1. app.py +9 -9
  2. constants.py +1 -1
app.py CHANGED
@@ -97,13 +97,13 @@ def sample_explore_item(model_name, size_H, size_W):
97
  return "No item found", "No item found", "No item found", "No item found"
98
  model_name = explore_item['Model']
99
  example_id = explore_item['id']
100
- puzzle_md = f"### Puzzle [{example_id}]:\n\n" + explore_item['puzzle'].replace("## Clues", "### Clues").replace("\n", "<br>")
101
- model_reasoning_md = f"### {model_name}'s Reasoning:\n\n {explore_item['reasoning']}"
102
- model_prediction_md = f"### {model_name}'s Prediction:\n\n {str(explore_item['solution']).replace('___', 'null')}" + \
103
- "\n\n" + explore_item['solution_table_md']
104
  puzzle_solved = explore_item['correct_cells'] == explore_item['total_cells']
105
  cell_acc = explore_item["correct_cells"] / explore_item["total_cells"] * 100
106
- model_eval_md = f"### Evaluation:\n\n **Total Cells**: {explore_item['total_cells']} | **Correct Cells**: {explore_item['correct_cells']} | **Puzzle solved**: {puzzle_solved} | **Cell Acc**: {cell_acc:.2f}%"
107
  return puzzle_md, model_reasoning_md, model_prediction_md, model_eval_md
108
 
109
 
@@ -121,10 +121,10 @@ def _tab_explore():
121
  gr.Markdown("### πŸš€ Click below to sample a puzzle. ⬇️ ")
122
  explore_button = gr.Button("πŸ¦“ Sample a Zebra Puzzle!", elem_id="explore-button")
123
 
124
- puzzle_md = gr.Markdown("\n\nTo be loaded", elem_id="puzzle-md", elem_classes="box_md")
125
- model_reasoning_md = gr.Markdown("\n\nTo be loaded", elem_id="model-reasoning-md", elem_classes="box_md")
126
- model_prediction_md = gr.Markdown("\n\nTo be loaded", elem_id="model-prediction-md", elem_classes="box_md")
127
- model_eval_md = gr.Markdown("\n\nTo be loaded", elem_id="model-eval-md", elem_classes="box_md")
128
 
129
  explore_button.click(fn=sample_explore_item,
130
  inputs=[model_selection, size_H_selection, size_W_selection],
 
97
  return "No item found", "No item found", "No item found", "No item found"
98
  model_name = explore_item['Model']
99
  example_id = explore_item['id']
100
+ puzzle_md = f"### πŸ¦“ Puzzle [{example_id}]:\n\n" + explore_item['puzzle'].replace("## Clues:", "### **Clues:**").replace("\n", "<br>")
101
+ model_reasoning_md = f"### πŸ€– Reasoning of {model_name}:\n\n {explore_item['reasoning']}"
102
+ model_prediction_md = f"### πŸ’¬ Answer of {model_name}:\n\n**Json format:** {str(explore_item['solution']).replace('___', 'null')}" + \
103
+ "\n\n**Table format:**\n" + explore_item['solution_table_md']
104
  puzzle_solved = explore_item['correct_cells'] == explore_item['total_cells']
105
  cell_acc = explore_item["correct_cells"] / explore_item["total_cells"] * 100
106
+ model_eval_md = f"### πŸ†š Evaluation:\n\n **Total Cells**: {explore_item['total_cells']} | **Correct Cells**: {explore_item['correct_cells']} | **Puzzle solved**: {puzzle_solved} | **Cell Acc**: {cell_acc:.2f}%"
107
  return puzzle_md, model_reasoning_md, model_prediction_md, model_eval_md
108
 
109
 
 
121
  gr.Markdown("### πŸš€ Click below to sample a puzzle. ⬇️ ")
122
  explore_button = gr.Button("πŸ¦“ Sample a Zebra Puzzle!", elem_id="explore-button")
123
 
124
+ puzzle_md = gr.Markdown("### πŸ¦“ Puzzle: \n\nTo be loaded", elem_id="puzzle-md", elem_classes="box_md")
125
+ model_reasoning_md = gr.Markdown("### πŸ€– Reasoning: \n\nTo be loaded", elem_id="model-reasoning-md", elem_classes="box_md")
126
+ model_prediction_md = gr.Markdown("### πŸ’¬ Answer: \n\nTo be loaded", elem_id="model-prediction-md", elem_classes="box_md")
127
+ model_eval_md = gr.Markdown("### πŸ†š Evaluation: \n\nTo be loaded", elem_id="model-eval-md", elem_classes="box_md")
128
 
129
  explore_button.click(fn=sample_explore_item,
130
  inputs=[model_selection, size_H_selection, size_W_selection],
constants.py CHANGED
@@ -280,7 +280,7 @@ button.selected[role="tab"][aria-selected="true"] {
280
  .box_md{
281
  border: 1px solid #000000;
282
  border-radius: 10px;
283
- padding: 5px;
284
  font-size: 12pt;
285
  margin: 5px;
286
  }
 
280
  .box_md{
281
  border: 1px solid #000000;
282
  border-radius: 10px;
283
+ padding: 10px;
284
  font-size: 12pt;
285
  margin: 5px;
286
  }