|
3 | 3 | import gradio as gr |
4 | 4 |
|
5 | 5 | from unitxt.ui import constants as cons |
6 | | -from unitxt.ui.ui_tiny_utils import * |
| 6 | +from unitxt.ui.ui_tiny_utils import ( |
| 7 | + activate_button, |
| 8 | + deactivate_button, |
| 9 | + go_to_intro_tab, |
| 10 | + go_to_json_tab, |
| 11 | + go_to_main_tab, |
| 12 | + make_group_invisible, |
| 13 | + make_group_visible, |
| 14 | + make_json_visible, |
| 15 | + make_mrk_down_invisible, |
| 16 | + make_mrk_down_visible, |
| 17 | + make_txt_visible, |
| 18 | + select_checkbox, |
| 19 | +) |
7 | 20 | from unitxt.ui.ui_utils import ( |
8 | 21 | build_command, |
9 | 22 | create_dataframe, |
@@ -137,8 +150,7 @@ def display_json_button(element): |
137 | 150 | make_json_visible(json_el), |
138 | 151 | ) |
139 | 152 |
|
140 | | - else: |
141 | | - return tabs, f"Error: {element}'s json not found", None, None |
| 153 | + return tabs, f"Error: {element}'s json not found", None, None |
142 | 154 |
|
143 | 155 |
|
144 | 156 | ###################### |
@@ -230,38 +242,40 @@ def display_json_button(element): |
230 | 242 | "Previous Sample", interactive=False |
231 | 243 | ) |
232 | 244 | next_sample = gr.Button("Next Sample", interactive=False) |
233 | | - with gr.Accordion(): |
234 | | - with gr.Group() as prompt_group: |
235 | | - prompts_title = gr.Markdown("## Prompt:") |
236 | | - selected_prompt = gr.Textbox( |
237 | | - lines=5, |
238 | | - show_copy_button=True, |
239 | | - label="Prompt", |
240 | | - autoscroll=False, |
241 | | - ) |
| 245 | + with gr.Group() as prompt_group: |
| 246 | + prompts_title = gr.Markdown(" ## Prompt:") |
| 247 | + selected_prompt = gr.Textbox( |
| 248 | + lines=5, |
| 249 | + show_copy_button=True, |
| 250 | + label="Prompt", |
| 251 | + autoscroll=False, |
| 252 | + ) |
242 | 253 |
|
243 | | - target = gr.Textbox(lines=1, label="Target", scale=3) |
| 254 | + target = gr.Textbox(lines=1, label="Target", scale=3) |
244 | 255 |
|
245 | 256 | with gr.Group(visible=False) as infer_group: |
246 | | - infer_title = gr.Markdown("## Inference:") |
| 257 | + infer_title = gr.Markdown(" ## Inference:") |
| 258 | + |
247 | 259 | prediction = gr.Textbox( |
248 | | - lines=1, |
| 260 | + lines=5, |
249 | 261 | label="Model prediction", |
250 | 262 | value=" ", |
251 | 263 | autoscroll=False, |
252 | 264 | ) |
253 | | - with gr.Row(): |
254 | | - instance_scores = gr.DataFrame( |
255 | | - label="Instance scores", |
256 | | - value=cons.EMPTY_SCORES_FRAME, |
257 | | - headers=cons.SCORE_FRAME_HEADERS, |
258 | | - height=200, |
259 | | - ) |
| 265 | + |
| 266 | + instance_scores = gr.DataFrame( |
| 267 | + label="Instance scores", |
| 268 | + value=cons.EMPTY_SCORES_FRAME, |
| 269 | + headers=cons.SCORE_FRAME_HEADERS, |
| 270 | + ) |
| 271 | + with gr.Accordion( |
| 272 | + label=f"Aggregated scores for {cons.PROMPT_SAMPLE_SIZE} predictions", |
| 273 | + open=False, |
| 274 | + ): |
260 | 275 | global_scores = gr.DataFrame( |
261 | | - label=f"Aggregated scores for {cons.PROMPT_SAMPLE_SIZE} predictions", |
262 | 276 | value=cons.EMPTY_SCORES_FRAME, |
263 | 277 | headers=cons.SCORE_FRAME_HEADERS, |
264 | | - height=200, |
| 278 | + visible=True, |
265 | 279 | ) |
266 | 280 | with gr.TabItem("Code", id="code"): |
267 | 281 | code_intro = gr.Markdown(value=cons.CODE_INTRO_TXT) |
|
0 commit comments