Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,9 +8,18 @@ def show_html_in_iframe(page_idx, html_files, curr_split):
|
|
| 8 |
iframe_html = f'<iframe src="{url}" width="100%" height="1000"></iframe>'
|
| 9 |
return iframe_html
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
with gr.Blocks() as demo:
|
| 12 |
with gr.Row():
|
| 13 |
-
instance_type_dropdown = gr.Dropdown(choices=['
|
| 14 |
slider = gr.Slider(minimum=0, step=1, label='Data Instance')
|
| 15 |
|
| 16 |
# Dynamic update of slider based on instance type
|
|
|
|
| 8 |
iframe_html = f'<iframe src="{url}" width="100%" height="1000"></iframe>'
|
| 9 |
return iframe_html
|
| 10 |
|
| 11 |
+
# Example lists of HTML files for 'test' and 'dev' instances
|
| 12 |
+
train_html_files = [f for f in os.listdir(os.path.join("html_files", "train")) if f.endswith('.html')]
|
| 13 |
+
dev_html_files = [f for f in os.listdir(os.path.join("html_files", "dev")) if f.endswith('.html')]
|
| 14 |
+
|
| 15 |
+
# Function to return the appropriate list based on instance type
|
| 16 |
+
def get_html_files_list(instance_type):
|
| 17 |
+
return train_html_files if instance_type == 'train' else dev_html_files
|
| 18 |
+
|
| 19 |
+
|
| 20 |
with gr.Blocks() as demo:
|
| 21 |
with gr.Row():
|
| 22 |
+
instance_type_dropdown = gr.Dropdown(choices=['train', 'dev'], label='Instance Type')
|
| 23 |
slider = gr.Slider(minimum=0, step=1, label='Data Instance')
|
| 24 |
|
| 25 |
# Dynamic update of slider based on instance type
|