lovodkin93 commited on
Commit
2499414
1 Parent(s): 81b6700

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -21
app.py CHANGED
@@ -1,25 +1,5 @@
1
  import gradio as gr
2
-
3
- # List of HTML files
4
- html_files = [
5
- '182.html', '141.html', '116.html', '100.html', '157.html', '120.html',
6
- '177.html', '161.html', '136.html', '15.html', '14.html', '137.html',
7
- '160.html', '176.html', '121.html', '156.html', '101.html', '117.html',
8
- '140.html', '18.html', '183.html', '126.html', '171.html', '167.html',
9
- '188.html', '130.html', '13.html', '184.html', '147.html', '110.html',
10
- '106.html', '151.html', '150.html', '107.html', '111.html', '146.html',
11
- '185.html', '12.html', '131.html', '166.html', '170.html', '127.html',
12
- '108.html', '11.html', '149.html', '1.html', '132.html', '165.html',
13
- '173.html', '124.html', '153.html', '104.html', '112.html', '145.html',
14
- '186.html', '169.html', '128.html', '129.html', '187.html', '168.html',
15
- '144.html', '113.html', '105.html', '152.html', '125.html', '172.html',
16
- '164.html', '0.html', '133.html', '10.html', '148.html', '109.html',
17
- '155.html', '102.html', '114.html', '143.html', '138.html', '180.html',
18
- '179.html', '159.html', '118.html', '17.html', '134.html', '163.html',
19
- '175.html', '122.html', '123.html', '174.html', '162.html', '135.html',
20
- '16.html', '119.html', '158.html', '178.html', '181.html', '139.html',
21
- '142.html', '115.html', '103.html', '154.html'
22
- ]
23
 
24
  # Function to show HTML content using an iframe
25
  def show_html_in_iframe(page_idx):
@@ -28,6 +8,10 @@ def show_html_in_iframe(page_idx):
28
  iframe_html = f'<iframe src="{url}" width="100%" height="2000"></iframe>'
29
  return iframe_html
30
 
 
 
 
 
31
  with gr.Blocks() as demo:
32
  # Create a slider component to select the HTML page
33
  slider = gr.Slider(minimum=0, maximum=len(html_files)-1, step=1, label='Data Instance')
 
1
  import gradio as gr
2
+ import os
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  # Function to show HTML content using an iframe
5
  def show_html_in_iframe(page_idx):
 
8
  iframe_html = f'<iframe src="{url}" width="100%" height="2000"></iframe>'
9
  return iframe_html
10
 
11
+ # Path to the directory containing HTML files
12
+ html_files_path = os.path.join("html_files", "test")
13
+ html_files = [f for f in os.listdir(html_files_path) if f.endswith('.html')]
14
+
15
  with gr.Blocks() as demo:
16
  # Create a slider component to select the HTML page
17
  slider = gr.Slider(minimum=0, maximum=len(html_files)-1, step=1, label='Data Instance')