File size: 2,448 Bytes
8b63887
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72f75f7
 
8b63887
 
 
 
 
 
 
 
 
 
72f75f7
 
 
 
8b63887
d99c801
 
 
 
 
 
 
 
 
 
 
 
 
 
72f75f7
8b63887
 
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
44
45
46
47
48
49
import gradio as gr
import random

# List of interesting sites with their descriptions
interesting_sites = [
    {"link": "https://www.wikipedia.org", "description": "The free encyclopedia that anyone can edit."},
    {"link": "https://www.github.com", "description": "A platform for version control and collaboration."},
    {"link": "https://www.stackoverflow.com", "description": "A question and answer site for professional and enthusiast programmers."},
    {"link": "https://www.reddit.com", "description": "A network of communities based on people's interests."},
    {"link": "https://www.medium.com", "description": "A place to read, write, and interact with the stories that matter most to you."},
    {"link": "https://www.producthunt.com", "description": "A curation of the best new products, every day."},
    {"link": "https://www.khanacademy.org", "description": "A free, world-class education for anyone, anywhere."},
    {"link": "https://www.coursera.org", "description": "Online courses from top universities and companies."},
    {"link": "https://www.ted.com", "description": "Ideas worth spreading."},
    {"link": "https://www.quora.com", "description": "A place to share knowledge and better understand the world."},
    {"link": "https://bandlab.com/mikhailbugrovsky", "description": "A social media platform for musicians and music creators."},
    {"link": "https://x.com/redlancer0", "description": "A social media platform for sharing thoughts and ideas."},
]

# Function to generate 10 random interesting sites
def generate_random_sites():
    random.shuffle(interesting_sites)
    return [
        (site["link"], site["description"])
        for site in interesting_sites[:10]
    ]

# Function to clear the output fields
def clear_output():
    return "", ""

# Create the Gradio interface
with gr.Blocks() as iface:
    gr.Markdown("# 10 Random Interesting Sites")
    gr.Markdown("Click the button to generate 10 random interesting sites with descriptions.")
    
    with gr.Row():
        btn_generate = gr.Button("Generate Sites")
        btn_clear = gr.Button("Clear")
    
    with gr.Row():
        link_output = gr.Textbox(label="Link")
        description_output = gr.Textbox(label="Description")
    
    btn_generate.click(generate_random_sites, outputs=[link_output, description_output])
    btn_clear.click(clear_output, outputs=[link_output, description_output])

# Launch the interface
iface.launch()