File size: 2,121 Bytes
1974b02
86c3edd
281253d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229f456
 
 
 
 
 
86c3edd
281253d
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import gradio as gr

# List of HTML files
html_files = [
    '182.html', '141.html', '116.html', '100.html', '157.html', '120.html',
    '177.html', '161.html', '136.html', '15.html', '14.html', '137.html',
    '160.html', '176.html', '121.html', '156.html', '101.html', '117.html',
    '140.html', '18.html', '183.html', '126.html', '171.html', '167.html',
    '188.html', '130.html', '13.html', '184.html', '147.html', '110.html',
    '106.html', '151.html', '150.html', '107.html', '111.html', '146.html',
    '185.html', '12.html', '131.html', '166.html', '170.html', '127.html',
    '108.html', '11.html', '149.html', '1.html', '132.html', '165.html',
    '173.html', '124.html', '153.html', '104.html', '112.html', '145.html',
    '186.html', '169.html', '128.html', '129.html', '187.html', '168.html',
    '144.html', '113.html', '105.html', '152.html', '125.html', '172.html',
    '164.html', '0.html', '133.html', '10.html', '148.html', '109.html',
    '155.html', '102.html', '114.html', '143.html', '138.html', '180.html',
    '179.html', '159.html', '118.html', '17.html', '134.html', '163.html',
    '175.html', '122.html', '123.html', '174.html', '162.html', '135.html',
    '16.html', '119.html', '158.html', '178.html', '181.html', '139.html',
    '142.html', '115.html', '103.html', '154.html'
]

# Function to show HTML content using an iframe
def show_html_in_iframe(page_idx):
    # Construct the URL using the selected index
    url = f'https://wmtis.s3.eu-west-1.amazonaws.com/test/{html_files[page_idx]}'
    iframe_html = f'<iframe src="{url}" width="100%" height="2000"></iframe>'
    return iframe_html

# Create a slider component to select the HTML page
slider = gr.Slider(minimum=0, maximum=len(html_files)-1, step=1, label='Page')

# Create the Gradio interface
iface = gr.Interface(fn=show_html_in_iframe,
                     inputs=slider,
                     outputs=gr.HTML(),
                     title="HTML Viewer with Event Listeners",
                     description="Displays HTML content with JavaScript event listeners via an iframe.")

# Display the interface
iface.launch()