Spaces:
Running
Running
feat: prompt grouping
Browse files
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.
|
| 629 |
-
for
|
| 630 |
-
with antd.
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 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 |
+
}
|