Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,6 +44,23 @@ example_prompts = {
|
|
| 44 |
- Touchscreen panel for settings
|
| 45 |
- Modern matte black finish
|
| 46 |
- Hand-drawn concept sketch style"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
],
|
| 48 |
"Mockup": [
|
| 49 |
"""A clean hand-drawn style wireframe for a mobile banking app:
|
|
@@ -141,7 +158,7 @@ with gr.Blocks(css=css, title="Workflow Canvas") as demo:
|
|
| 141 |
<div style="text-align:center;">
|
| 142 |
<h1>Workflow Canvas</h1>
|
| 143 |
<p>Generate design concepts and workflow diagrams for your business needs using our multi-tab interface.</p>
|
| 144 |
-
<p><strong>AI Spaces:</strong> Product Design, Mockup, Infographic, Diagram, Flowchart</p>
|
| 145 |
</div>
|
| 146 |
"""
|
| 147 |
)
|
|
@@ -157,8 +174,8 @@ with gr.Blocks(css=css, title="Workflow Canvas") as demo:
|
|
| 157 |
steps_slider = gr.Slider(label="Inference Steps", minimum=1, maximum=50, step=1, value=20)
|
| 158 |
guidance_slider = gr.Slider(label="Guidance Scale", minimum=0.0, maximum=15.0, step=0.5, value=7.5)
|
| 159 |
|
| 160 |
-
# Main area: Tabbed interface
|
| 161 |
-
#
|
| 162 |
with gr.Column(scale=8):
|
| 163 |
with gr.Tabs():
|
| 164 |
# Tab 1: Product Design
|
|
@@ -175,7 +192,21 @@ with gr.Blocks(css=css, title="Workflow Canvas") as demo:
|
|
| 175 |
for ex in example_prompts["Product Design"]:
|
| 176 |
gr.Button(ex, variant="secondary").click(fn=lambda ex=ex: set_prompt(ex), outputs=pd_prompt)
|
| 177 |
|
| 178 |
-
# Tab 2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
with gr.Tab("Mockup"):
|
| 180 |
mock_prompt = gr.Textbox(
|
| 181 |
label="Mockup Prompt",
|
|
@@ -189,7 +220,7 @@ with gr.Blocks(css=css, title="Workflow Canvas") as demo:
|
|
| 189 |
for ex in example_prompts["Mockup"]:
|
| 190 |
gr.Button(ex, variant="secondary").click(fn=lambda ex=ex: set_prompt(ex), outputs=mock_prompt)
|
| 191 |
|
| 192 |
-
# Tab
|
| 193 |
with gr.Tab("Infographic"):
|
| 194 |
info_prompt = gr.Textbox(
|
| 195 |
label="Infographic Prompt",
|
|
@@ -203,7 +234,7 @@ with gr.Blocks(css=css, title="Workflow Canvas") as demo:
|
|
| 203 |
for ex in example_prompts["Infographic"]:
|
| 204 |
gr.Button(ex, variant="secondary").click(fn=lambda ex=ex: set_prompt(ex), outputs=info_prompt)
|
| 205 |
|
| 206 |
-
# Tab
|
| 207 |
with gr.Tab("Diagram"):
|
| 208 |
diag_prompt = gr.Textbox(
|
| 209 |
label="Diagram Prompt",
|
|
@@ -217,7 +248,7 @@ with gr.Blocks(css=css, title="Workflow Canvas") as demo:
|
|
| 217 |
for ex in example_prompts["Diagram"]:
|
| 218 |
gr.Button(ex, variant="secondary").click(fn=lambda ex=ex: set_prompt(ex), outputs=diag_prompt)
|
| 219 |
|
| 220 |
-
# Tab
|
| 221 |
with gr.Tab("Flowchart"):
|
| 222 |
flow_prompt = gr.Textbox(
|
| 223 |
label="Flowchart Prompt",
|
|
@@ -238,6 +269,12 @@ with gr.Blocks(css=css, title="Workflow Canvas") as demo:
|
|
| 238 |
outputs=[pd_image, seed_slider]
|
| 239 |
)
|
| 240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
mock_generate.click(
|
| 242 |
fn=generate_image,
|
| 243 |
inputs=[mock_prompt, seed_slider, randomize_seed, width_slider, height_slider, steps_slider, guidance_slider],
|
|
|
|
| 44 |
- Touchscreen panel for settings
|
| 45 |
- Modern matte black finish
|
| 46 |
- Hand-drawn concept sketch style"""
|
| 47 |
+
],
|
| 48 |
+
"Mindmap": [
|
| 49 |
+
"""A handrawn colorful mind map diagram, educational style, vibrant colors, clear hierarchy, golden ratio layout.
|
| 50 |
+
KNOWLEDGE
|
| 51 |
+
βββ ACQUISITION [Brain with Lightning ~60px]
|
| 52 |
+
β βββ READING [Open Book with Glow]
|
| 53 |
+
β βββ PRACTICE [Hands-on Tools]
|
| 54 |
+
β βββ OBSERVATION [Eye with Magnifier]
|
| 55 |
+
βββ PROCESSING [Gear Network ~50px]
|
| 56 |
+
β βββ ANALYSIS [Graph Trending Up]
|
| 57 |
+
β βββ SYNTHESIS [Puzzle Pieces]
|
| 58 |
+
βββ RETENTION [Memory Chip ~45px]
|
| 59 |
+
β βββ SHORT-TERM [Quick Flash]
|
| 60 |
+
β βββ LONG-TERM [Solid Archive]
|
| 61 |
+
βββ APPLICATION
|
| 62 |
+
βββ CREATION [Artist Palette]
|
| 63 |
+
βββ INNOVATION [Lightbulb Constellation]"""
|
| 64 |
],
|
| 65 |
"Mockup": [
|
| 66 |
"""A clean hand-drawn style wireframe for a mobile banking app:
|
|
|
|
| 158 |
<div style="text-align:center;">
|
| 159 |
<h1>Workflow Canvas</h1>
|
| 160 |
<p>Generate design concepts and workflow diagrams for your business needs using our multi-tab interface.</p>
|
| 161 |
+
<p><strong>AI Spaces:</strong> Product Design, Mindmap, Mockup, Infographic, Diagram, Flowchart</p>
|
| 162 |
</div>
|
| 163 |
"""
|
| 164 |
)
|
|
|
|
| 174 |
steps_slider = gr.Slider(label="Inference Steps", minimum=1, maximum=50, step=1, value=20)
|
| 175 |
guidance_slider = gr.Slider(label="Guidance Scale", minimum=0.0, maximum=15.0, step=0.5, value=7.5)
|
| 176 |
|
| 177 |
+
# Main area: Tabbed interface with updated tab order:
|
| 178 |
+
# 1: Product Design, 2: Mindmap, 3: Mockup, 4: Infographic, 5: Diagram, 6: Flowchart
|
| 179 |
with gr.Column(scale=8):
|
| 180 |
with gr.Tabs():
|
| 181 |
# Tab 1: Product Design
|
|
|
|
| 192 |
for ex in example_prompts["Product Design"]:
|
| 193 |
gr.Button(ex, variant="secondary").click(fn=lambda ex=ex: set_prompt(ex), outputs=pd_prompt)
|
| 194 |
|
| 195 |
+
# Tab 2: Mindmap
|
| 196 |
+
with gr.Tab("Mindmap"):
|
| 197 |
+
mindmap_prompt = gr.Textbox(
|
| 198 |
+
label="Mindmap Prompt",
|
| 199 |
+
placeholder="Enter a mind map description...",
|
| 200 |
+
lines=5,
|
| 201 |
+
value=example_prompts["Mindmap"][0]
|
| 202 |
+
)
|
| 203 |
+
mindmap_generate = gr.Button("Generate Mindmap")
|
| 204 |
+
mindmap_image = gr.Image(label="Generated Mindmap", value="w6.webp")
|
| 205 |
+
with gr.Accordion("Example Prompts", open=True, elem_classes="example-accordion"):
|
| 206 |
+
for ex in example_prompts["Mindmap"]:
|
| 207 |
+
gr.Button(ex, variant="secondary").click(fn=lambda ex=ex: set_prompt(ex), outputs=mindmap_prompt)
|
| 208 |
+
|
| 209 |
+
# Tab 3: Mockup
|
| 210 |
with gr.Tab("Mockup"):
|
| 211 |
mock_prompt = gr.Textbox(
|
| 212 |
label="Mockup Prompt",
|
|
|
|
| 220 |
for ex in example_prompts["Mockup"]:
|
| 221 |
gr.Button(ex, variant="secondary").click(fn=lambda ex=ex: set_prompt(ex), outputs=mock_prompt)
|
| 222 |
|
| 223 |
+
# Tab 4: Infographic
|
| 224 |
with gr.Tab("Infographic"):
|
| 225 |
info_prompt = gr.Textbox(
|
| 226 |
label="Infographic Prompt",
|
|
|
|
| 234 |
for ex in example_prompts["Infographic"]:
|
| 235 |
gr.Button(ex, variant="secondary").click(fn=lambda ex=ex: set_prompt(ex), outputs=info_prompt)
|
| 236 |
|
| 237 |
+
# Tab 5: Diagram
|
| 238 |
with gr.Tab("Diagram"):
|
| 239 |
diag_prompt = gr.Textbox(
|
| 240 |
label="Diagram Prompt",
|
|
|
|
| 248 |
for ex in example_prompts["Diagram"]:
|
| 249 |
gr.Button(ex, variant="secondary").click(fn=lambda ex=ex: set_prompt(ex), outputs=diag_prompt)
|
| 250 |
|
| 251 |
+
# Tab 6: Flowchart
|
| 252 |
with gr.Tab("Flowchart"):
|
| 253 |
flow_prompt = gr.Textbox(
|
| 254 |
label="Flowchart Prompt",
|
|
|
|
| 269 |
outputs=[pd_image, seed_slider]
|
| 270 |
)
|
| 271 |
|
| 272 |
+
mindmap_generate.click(
|
| 273 |
+
fn=generate_image,
|
| 274 |
+
inputs=[mindmap_prompt, seed_slider, randomize_seed, width_slider, height_slider, steps_slider, guidance_slider],
|
| 275 |
+
outputs=[mindmap_image, seed_slider]
|
| 276 |
+
)
|
| 277 |
+
|
| 278 |
mock_generate.click(
|
| 279 |
fn=generate_image,
|
| 280 |
inputs=[mock_prompt, seed_slider, randomize_seed, width_slider, height_slider, steps_slider, guidance_slider],
|