Doubleupai commited on
Commit
d99c801
·
verified ·
1 Parent(s): 72f75f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -36
app.py CHANGED
@@ -30,42 +30,20 @@ def clear_output():
30
  return "", ""
31
 
32
  # Create the Gradio interface
33
- iface = gr.Interface(
34
- fn=generate_random_sites, # Function to call
35
- inputs=None, # No input needed
36
- outputs=[gr.Textbox(label="Link"), gr.Textbox(label="Description")], # Output type: text (for the link and description)
37
- title="10 Random Interesting Sites",
38
- description="Click the button to generate 10 random interesting sites with descriptions.",
39
- live=False, # The interface is not live
40
- examples=[[]], # No examples needed
41
- css="""
42
- body {
43
- background-color: #f0f8ff;
44
- font-family: 'Arial', sans-serif;
45
- }
46
- .gradio-container {
47
- max-width: 600px;
48
- margin: 0 auto;
49
- padding: 20px;
50
- border-radius: 10px;
51
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
52
- }
53
- .gradio-button {
54
- background-color: #4CAF50;
55
- color: white;
56
- padding: 10px 20px;
57
- border: none;
58
- border-radius: 5px;
59
- cursor: pointer;
60
- }
61
- .gradio-button:hover {
62
- background-color: #45a049;
63
- }
64
- """
65
- )
66
-
67
- # Add a "Clear" button
68
- iface.add_button("Clear", clear_output, outputs=[gr.Textbox(label="Link"), gr.Textbox(label="Description")])
69
 
70
  # Launch the interface
71
  iface.launch()
 
30
  return "", ""
31
 
32
  # Create the Gradio interface
33
+ with gr.Blocks() as iface:
34
+ gr.Markdown("# 10 Random Interesting Sites")
35
+ gr.Markdown("Click the button to generate 10 random interesting sites with descriptions.")
36
+
37
+ with gr.Row():
38
+ btn_generate = gr.Button("Generate Sites")
39
+ btn_clear = gr.Button("Clear")
40
+
41
+ with gr.Row():
42
+ link_output = gr.Textbox(label="Link")
43
+ description_output = gr.Textbox(label="Description")
44
+
45
+ btn_generate.click(generate_random_sites, outputs=[link_output, description_output])
46
+ btn_clear.click(clear_output, outputs=[link_output, description_output])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  # Launch the interface
49
  iface.launch()