trying to visualize
Browse files
app.py
CHANGED
|
@@ -106,10 +106,13 @@ def gradio_interface() -> gr.Blocks:
|
|
| 106 |
ds = load_dataset(results_repo, split='train')
|
| 107 |
full_df = pd.DataFrame(ds)
|
| 108 |
filenames = full_df['result_filename'].to_list()
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
| 110 |
plot = gr.Plot()
|
| 111 |
|
| 112 |
-
def
|
| 113 |
local_path = read_file_from_hub(selected_file)
|
| 114 |
with Path(local_path).open("r") as f:
|
| 115 |
raw = f.read()
|
|
@@ -121,16 +124,11 @@ def gradio_interface() -> gr.Blocks:
|
|
| 121 |
else:
|
| 122 |
boundary = load_boundary(boundary_json)
|
| 123 |
|
| 124 |
-
vis = make_visual(boundary)
|
| 125 |
return vis
|
| 126 |
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
triggers="load", # when app loads
|
| 130 |
-
fn=update_plot,
|
| 131 |
-
inputs=[dropdown],
|
| 132 |
-
outputs=[plot]
|
| 133 |
-
)
|
| 134 |
|
| 135 |
with gr.TabItem("✉️ Submit", elem_id="boundary-benchmark-tab-table"):
|
| 136 |
gr.Markdown(
|
|
|
|
| 106 |
ds = load_dataset(results_repo, split='train')
|
| 107 |
full_df = pd.DataFrame(ds)
|
| 108 |
filenames = full_df['result_filename'].to_list()
|
| 109 |
+
with gr.Row():
|
| 110 |
+
dropdown = gr.Dropdown(choices=filenames, label="Choose a file", value=filenames[0])
|
| 111 |
+
rld_btn = gr.Button(value="Reload")
|
| 112 |
+
|
| 113 |
plot = gr.Plot()
|
| 114 |
|
| 115 |
+
def get_boundary_vis(selected_file):
|
| 116 |
local_path = read_file_from_hub(selected_file)
|
| 117 |
with Path(local_path).open("r") as f:
|
| 118 |
raw = f.read()
|
|
|
|
| 124 |
else:
|
| 125 |
boundary = load_boundary(boundary_json)
|
| 126 |
|
| 127 |
+
vis = make_visual(boundary, inputs=[dropdown])
|
| 128 |
return vis
|
| 129 |
|
| 130 |
+
demo.load(get_boundary_vis, dropdown, plot)
|
| 131 |
+
rld_btn.click(get_boundary_vis, dropdown, plot)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
with gr.TabItem("✉️ Submit", elem_id="boundary-benchmark-tab-table"):
|
| 134 |
gr.Markdown(
|