sriting commited on
Commit
04cbd74
Β·
1 Parent(s): a2b1789

feat: prompt grouping

Browse files
Files changed (2) hide show
  1. app.py +64 -15
  2. config.py +58 -50
app.py CHANGED
@@ -527,6 +527,51 @@ css = """
527
  box-sizing: border-box;
528
  scroll-behavior: smooth;
529
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
  """
531
 
532
  def scroll_to_bottom():
@@ -624,21 +669,25 @@ with gr.Blocks(css=css) as demo, ms.Application(), antdx.XProvider():
624
 
625
  antd.Divider("Examples")
626
 
627
- # Examples
628
- with antd.Flex(gap="small", wrap=True):
629
- for example in EXAMPLES:
630
- with antd.Card(
631
- elem_style=dict(
632
- flex="1 1 fit-content"),
633
- hoverable=True) as example_card:
634
- antd.Card.Meta(
635
- title=example['title'],
636
- description=example['description'])
637
-
638
- example_card.click(
639
- fn=select_example(
640
- example),
641
- outputs=[code_input])
 
 
 
 
642
 
643
  with antd.Col(span=12):
644
  with ms.Div(elem_classes="right_panel"):
 
527
  box-sizing: border-box;
528
  scroll-behavior: smooth;
529
  }
530
+
531
+ /* Example card styles */
532
+ .example-card {
533
+ flex: 1 1 300px;
534
+ max-width: 400px;
535
+ margin: 8px;
536
+ transition: all 0.3s;
537
+ cursor: pointer;
538
+ border: 1px solid #e8e8e8;
539
+ border-radius: 8px;
540
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
541
+ }
542
+
543
+ .example-card:hover {
544
+ transform: translateY(-4px);
545
+ box-shadow: 0 4px 12px rgba(0,0,0,0.1);
546
+ border-color: #d9d9d9;
547
+ }
548
+
549
+ .example-card .ant-card-meta-title {
550
+ font-size: 16px;
551
+ font-weight: 500;
552
+ margin-bottom: 8px;
553
+ color: #262626;
554
+ }
555
+
556
+ .example-card .ant-card-meta-description {
557
+ color: #666;
558
+ font-size: 14px;
559
+ line-height: 1.5;
560
+ }
561
+
562
+ /* Example tabs styles */
563
+ .example-tabs .ant-tabs-nav {
564
+ margin-bottom: 16px;
565
+ }
566
+
567
+ .example-tabs .ant-tabs-tab {
568
+ padding: 8px 16px;
569
+ font-size: 15px;
570
+ }
571
+
572
+ .example-tabs .ant-tabs-tab-active {
573
+ font-weight: 500;
574
+ }
575
  """
576
 
577
  def scroll_to_bottom():
 
669
 
670
  antd.Divider("Examples")
671
 
672
+ # Examples with categories
673
+ with antd.Tabs(elem_classes="example-tabs") as example_tabs:
674
+ for category, examples in EXAMPLES.items():
675
+ with antd.Tabs.Item(key=category, label=category):
676
+ with antd.Flex(gap="small", wrap=True):
677
+ for example in examples:
678
+ with antd.Card(
679
+ elem_classes="example-card",
680
+ hoverable=True
681
+ ) as example_card:
682
+ antd.Card.Meta(
683
+ title=example['title'],
684
+ description=example['description']
685
+ )
686
+
687
+ example_card.click(
688
+ fn=select_example(example),
689
+ outputs=[code_input]
690
+ )
691
 
692
  with antd.Col(span=12):
693
  with ms.Div(elem_classes="right_panel"):
config.py CHANGED
@@ -44,53 +44,61 @@ All code is written in a single code block to form a complete code file for disp
44
  Output only the HTML, without any additional descriptive text. Make the UI looks modern and beautiful.
45
  """
46
 
47
- EXAMPLES = [
48
- {
49
- "title": "πŸ“‹ TODO list",
50
- "description": "Create a modern, interactive to-do list web app. It should allow users to add and remove items. Use beautiful styling and animations."
51
- },
52
- {
53
- "title": "⚑ SVG Loading Animation",
54
- "description": "Design an SVG dynamic loading animation with abstract style (e.g., rotating spinner, pulse dots) for web page loading status indication"
55
- },
56
- {
57
- "title": "✨ Particle Background",
58
- "description": "Create an HTML page with a canvas-based animated particle background. The particles should move smoothly and connect when close. Add a central heading text over the canvas"
59
- },
60
- {
61
- "title": "🌈 Colorful Gradient Background",
62
- "description": "Create an HTML page with a gradient background that transitions smoothly between multiple colors. Add a central heading text over the gradient"
63
- },
64
- {
65
- "title": "πŸ“ Sticky Note Wall",
66
- "description": "Create a sticky note wall where users can create, edit, drag, and delete colorful sticky notes. Make it visually appealing"
67
- },
68
- {
69
- "title": "⌨️ Typing Speed Game",
70
- "description": "Build a typing speed test web app. Randomly show a sentence, and track the user's typing speed in WPM (words per minute). Provide live feedback with colors and accuracy. Make it visually appealing."
71
- },
72
- {
73
- "title": "πŸ“ Markdown Editor with Preview",
74
- "description": "Develop a modern markdown editor with real-time preview. Use a split pane layout for input and output, support bold, italics, headers, lists, links, images, etc. No external libraries."
75
- },
76
- {
77
- "title": "πŸ–ΌοΈ Image Filter Tool",
78
- "description": "Create an image filter tool where users can upload an image and apply filters like grayscale, blur, brightness, contrast, etc. Show real-time preview."
79
- },
80
- {
81
- "title": "🧩 Maze Generator and Pathfinding Visualizer",
82
- "description": "Create a maze generator and pathfinding visualizer. Randomly generate a maze and visualize A* algorithm solving it step by step. Use canvas and animations. Make it visually appealing."
83
- },
84
- {
85
- "title": "πŸ’° Personal Finance Tracker",
86
- "description": "Create a personal finance tracker with user input, and visualize income and expenses using animated pie and bar charts. Use modern, responsive design in a single HTML file."
87
- },
88
- {
89
- "title": "πŸ”„ 3D Flipping Card",
90
- "description": "Create a 3D flipping card component that flips on hover. Include front and back content. Use only HTML and CSS (no JS). Make the flip smooth and realistic."
91
- },
92
- {
93
- "title": "πŸ’₯ Particle Explosion Effect",
94
- "description": "Implement a particle explosion effect when the user clicks anywhere on the page. Use canvas and JavaScript to animate colorful particles that fade out."
95
- },
96
- ]
 
 
 
 
 
 
 
 
 
44
  Output only the HTML, without any additional descriptive text. Make the UI looks modern and beautiful.
45
  """
46
 
47
+ EXAMPLES = {
48
+ "UI Components": [
49
+ {
50
+ "title": "πŸ”„ 3D Flipping Card",
51
+ "description": "Create a 3D flipping card component that flips on hover. Include front and back content. Use only HTML and CSS (no JS). Make the flip smooth and realistic."
52
+ },
53
+ {
54
+ "title": "⚑ SVG Loading Animation",
55
+ "description": "Design an SVG dynamic loading animation with abstract style (e.g., rotating spinner, pulse dots) for web page loading status indication"
56
+ },
57
+ {
58
+ "title": "✨ Particle Background",
59
+ "description": "Create an HTML page with a canvas-based animated particle background. The particles should move smoothly and connect when close. Add a central heading text over the canvas"
60
+ },
61
+ {
62
+ "title": "🌈 Colorful Gradient Background",
63
+ "description": "Create an HTML page with a gradient background that transitions smoothly between multiple colors. Add a central heading text over the gradient"
64
+ }
65
+ ],
66
+ "Interactive Apps": [
67
+ {
68
+ "title": "πŸ“‹ TODO list",
69
+ "description": "Create a modern, interactive to-do list web app. It should allow users to add and remove items. Use beautiful styling and animations."
70
+ },
71
+ {
72
+ "title": "πŸ“ Sticky Note Wall",
73
+ "description": "Create a sticky note wall where users can create, edit, drag, and delete colorful sticky notes. Make it visually appealing"
74
+ },
75
+ {
76
+ "title": "⌨️ Typing Speed Game",
77
+ "description": "Build a typing speed test web app. Randomly show a sentence, and track the user's typing speed in WPM (words per minute). Provide live feedback with colors and accuracy. Make it visually appealing."
78
+ },
79
+ {
80
+ "title": "πŸ’° Personal Finance Tracker",
81
+ "description": "Create a personal finance tracker with user input, and visualize income and expenses using animated pie and bar charts. Use modern, responsive design in a single HTML file."
82
+ }
83
+ ],
84
+ "Tools & Editors": [
85
+ {
86
+ "title": "πŸ“ Markdown Editor with Preview",
87
+ "description": "Develop a modern markdown editor with real-time preview. Use a split pane layout for input and output, support bold, italics, headers, lists, links, images, etc. No external libraries."
88
+ },
89
+ {
90
+ "title": "πŸ–ΌοΈ Image Filter Tool",
91
+ "description": "Create an image filter tool where users can upload an image and apply filters like grayscale, blur, brightness, contrast, etc. Show real-time preview."
92
+ }
93
+ ],
94
+ "Games & Visualizations": [
95
+ {
96
+ "title": "🧩 Maze Generator and Pathfinding Visualizer",
97
+ "description": "Create a maze generator and pathfinding visualizer. Randomly generate a maze and visualize A* algorithm solving it step by step. Use canvas and animations. Make it visually appealing."
98
+ },
99
+ {
100
+ "title": "πŸ’₯ Particle Explosion Effect",
101
+ "description": "Implement a particle explosion effect when the user clicks anywhere on the page. Use canvas and JavaScript to animate colorful particles that fade out."
102
+ }
103
+ ]
104
+ }