Spaces:
Sleeping
Sleeping
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() |