File size: 1,395 Bytes
215e9b9
2e0cbec
215e9b9
 
b6c6f81
 
215e9b9
 
 
 
 
4029298
215e9b9
09daeb6
 
4029298
 
215e9b9
4029298
215e9b9
 
 
 
 
4029298
215e9b9
 
4029298
215e9b9
 
4029298
215e9b9
 
4029298
 
215e9b9
4029298
215e9b9
 
 
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
import gradio as gr

# A dictionary to store website names and their URLs
WEBSITES = {
    "Extended List": "https://aman.ai/primers/ai/top-30-papers/",
    "Original List": "https://arc.net/folder/D0472A20-9C20-4D3F-B145-D2865C0A9FEE",
}

def open_website(website_name):
    """
    Function to retrieve the website URL from the dictionary.
    It embeds the selected website URL in an HTML iframe for interactive viewing.
    """
    url = WEBSITES.get(website_name)
    if url:
        # Embed the website URL inside an iframe for interactive viewing
        return f'<iframe src="{url}" width="100%" height="600"></iframe>'
    else:
        return "<p>Website not found.</p>"

# Define the Gradio interface
with gr.Blocks() as demo:
    gr.Markdown("# Website Selector Tool")
    gr.Markdown("""
    This tool allows you to select and interact with a website in an embedded viewer.
    """)
    
    # Dropdown for selecting a website
    website_name = gr.Dropdown(list(WEBSITES.keys()), label="Select a Website")
    
    # Button to trigger website embedding
    open_btn = gr.Button("Open Website")
    
    # HTML component to display the selected website in an iframe
    result = gr.HTML(label="Interactive Website Viewer")
    
    # Click event to retrieve the website and embed it in the iframe
    open_btn.click(open_website, inputs=website_name, outputs=result)

demo.launch()