broadfield-dev commited on
Commit
5bb1c00
·
verified ·
1 Parent(s): a63fbfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -1
app.py CHANGED
@@ -26,7 +26,41 @@ def interface():
26
  error_output = gr.Textbox(label="Error", interactive=False)
27
 
28
  code_input.change(fn=update_ui, inputs=code_input, outputs=[ui_preview, error_output])
29
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  return demo
31
 
32
  if __name__ == "__main__":
 
26
  error_output = gr.Textbox(label="Error", interactive=False)
27
 
28
  code_input.change(fn=update_ui, inputs=code_input, outputs=[ui_preview, error_output])
29
+ with gr.Accordion("HTML/CSS Code Examples", open=False):
30
+ with gr.Column():
31
+ example_buttons = []
32
+ example_codes = [
33
+ ('<h1>Hello World</h1>', "Basic Heading"),
34
+ ('<p style="color: red;">This is a paragraph.</p>', "Styled Paragraph"),
35
+ ('<button onclick="alert(\'Button clicked!\')">Click me</button>', "Interactive Button"),
36
+ ("""
37
+ <style>
38
+ .box {
39
+ width: 100px;
40
+ height: 100px;
41
+ background-color: blue;
42
+ }
43
+ </style>
44
+ <div class="box"></div>
45
+ """, "CSS Box"),
46
+ ("""
47
+ <style>
48
+ .container {
49
+ display: flex;
50
+ justify-content: space-between;
51
+ }
52
+ </style>
53
+ <div class="container">
54
+ <div style="background-color: red; width: 50px; height: 50px;"></div>
55
+ <div style="background-color: green; width: 50px; height: 50px;"></div>
56
+ </div>
57
+ """, "Flexbox Layout"),
58
+ ]
59
+
60
+ for code, label in example_codes:
61
+ button = gr.Button(label)
62
+ example_buttons.append(button)
63
+ button.click(fn=lambda x=code: x, outputs=code_input)
64
  return demo
65
 
66
  if __name__ == "__main__":