Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,83 +18,56 @@ pipe = DiffusionPipeline.from_pretrained(
|
|
| 18 |
MAX_SEED = np.iinfo(np.int32).max
|
| 19 |
MAX_IMAGE_SIZE = 2048
|
| 20 |
|
| 21 |
-
#
|
| 22 |
EXAMPLES = [
|
| 23 |
{
|
| 24 |
-
"title": "
|
| 25 |
-
"prompt": """A
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
│ ├── FRONTEND [Browser Icon]
|
| 32 |
-
│ └── BACKEND [Server Icon]
|
| 33 |
-
├── TEST & INTEGRATION [Gear Icon ~45px]
|
| 34 |
-
└── DEPLOY
|
| 35 |
-
└── END [Checkered Flag ~40px]""",
|
| 36 |
"width": 1024,
|
| 37 |
"height": 1024
|
| 38 |
},
|
| 39 |
{
|
| 40 |
-
"title": "
|
| 41 |
-
"prompt": """A hand-drawn style
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
├── MERGE TO MAIN [Pull Request Icon]
|
| 47 |
-
│ ├── CI/CD [Pipeline Icon ~40px]
|
| 48 |
-
│ └── BUILD [Gear Icon]
|
| 49 |
-
└── PRODUCTION
|
| 50 |
-
└── DEPLOY [Cloud Upload Icon]""",
|
| 51 |
"width": 1024,
|
| 52 |
"height": 1024
|
| 53 |
},
|
| 54 |
{
|
| 55 |
-
"title": "
|
| 56 |
-
"prompt": """A
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
├── PAYMENT [Credit Card Icon ~45px]
|
| 62 |
-
│ ├── VALIDATION [Lock Icon]
|
| 63 |
-
│ └── CONFIRMATION [Receipt Icon]
|
| 64 |
-
└── ORDER COMPLETE
|
| 65 |
-
└── THANK YOU [Smiley Icon]""",
|
| 66 |
"width": 1024,
|
| 67 |
"height": 1024
|
| 68 |
},
|
| 69 |
{
|
| 70 |
-
"title": "
|
| 71 |
-
"prompt": """A hand-drawn
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
├── TRANSFORMATION [Gear Icon ~45px]
|
| 77 |
-
│ ├── CLEANING [Brush Icon]
|
| 78 |
-
│ └── AGGREGATION [Bar Graph]
|
| 79 |
-
├── STORAGE [Cloud Icon ~50px]
|
| 80 |
-
└── ANALYTICS
|
| 81 |
-
└── DASHBOARDS [Monitor Icon]""",
|
| 82 |
"width": 1024,
|
| 83 |
"height": 1024
|
| 84 |
},
|
| 85 |
{
|
| 86 |
-
"title": "
|
| 87 |
-
"prompt": """A
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
├── MODEL TRAINING [Robot Icon ~50px]
|
| 93 |
-
│ ├── HYPERPARAM TUNING [Dial Knob]
|
| 94 |
-
│ └── EVALUATION [Magnifier Icon]
|
| 95 |
-
├── DEPLOYMENT [Cloud Icon ~45px]
|
| 96 |
-
└── MONITORING
|
| 97 |
-
└── FEEDBACK LOOP [Arrow Circle Icon]""",
|
| 98 |
"width": 1024,
|
| 99 |
"height": 1024
|
| 100 |
}
|
|
@@ -117,11 +90,11 @@ def infer(prompt, seed=42, randomize_seed=False, width=1024, height=1024, num_in
|
|
| 117 |
height=height,
|
| 118 |
num_inference_steps=num_inference_steps,
|
| 119 |
generator=generator,
|
| 120 |
-
guidance_scale=0.0 #
|
| 121 |
).images[0]
|
| 122 |
return image, seed
|
| 123 |
|
| 124 |
-
# CSS 스타일 (기존 구조
|
| 125 |
css = """
|
| 126 |
.container {
|
| 127 |
display: flex;
|
|
@@ -194,12 +167,11 @@ css = """
|
|
| 194 |
}
|
| 195 |
"""
|
| 196 |
|
| 197 |
-
# Gradio 인터페이스
|
| 198 |
with gr.Blocks(css=css) as demo:
|
| 199 |
gr.Markdown(
|
| 200 |
"""
|
| 201 |
-
<div class="title">GINI
|
| 202 |
-
<div class="subtitle">
|
| 203 |
""")
|
| 204 |
|
| 205 |
with gr.Row(equal_height=True):
|
|
@@ -207,13 +179,13 @@ with gr.Blocks(css=css) as demo:
|
|
| 207 |
with gr.Column(elem_id="input-column", scale=2):
|
| 208 |
with gr.Group(elem_classes="input-box"):
|
| 209 |
prompt = gr.Text(
|
| 210 |
-
label="
|
| 211 |
-
placeholder="Enter your
|
| 212 |
lines=10,
|
| 213 |
elem_classes="prompt-input"
|
| 214 |
)
|
| 215 |
-
run_button = gr.Button("Generate
|
| 216 |
-
result = gr.Image(label="Generated
|
| 217 |
|
| 218 |
with gr.Accordion("Advanced Settings", open=False):
|
| 219 |
seed = gr.Slider(
|
|
@@ -251,7 +223,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 251 |
|
| 252 |
# 오른쪽 예제 컬럼
|
| 253 |
with gr.Column(elem_id="examples-column", scale=1):
|
| 254 |
-
gr.Markdown("### Example
|
| 255 |
for example in EXAMPLES:
|
| 256 |
with gr.Group(elem_classes="example-card"):
|
| 257 |
gr.Markdown(f"#### {example['title']}")
|
|
|
|
| 18 |
MAX_SEED = np.iinfo(np.int32).max
|
| 19 |
MAX_IMAGE_SIZE = 2048
|
| 20 |
|
| 21 |
+
# 인포그래픽 예시들
|
| 22 |
EXAMPLES = [
|
| 23 |
{
|
| 24 |
+
"title": "Global Energy Mix",
|
| 25 |
+
"prompt": """A modern flat-style infographic about global renewable energy usage:
|
| 26 |
+
- Title: "Global Renewable Energy Share"
|
| 27 |
+
- Bar chart showing Solar, Wind, Hydro
|
| 28 |
+
- Pie chart: 40% Solar, 35% Wind, 25% Hydro
|
| 29 |
+
- Minimalist icons: sun, wind turbine, water wave
|
| 30 |
+
- Clean layout with pastel color scheme""",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
"width": 1024,
|
| 32 |
"height": 1024
|
| 33 |
},
|
| 34 |
{
|
| 35 |
+
"title": "Startup Growth Stats",
|
| 36 |
+
"prompt": """A hand-drawn style infographic illustrating startup growth stages:
|
| 37 |
+
- Title: "Startup Growth Journey"
|
| 38 |
+
- 5 main steps: Ideation, MVP, Early Users, Funding, Scaling
|
| 39 |
+
- Icons for each step (lightbulb, prototype gear, user group, money bag, rocket)
|
| 40 |
+
- Vibrant color palette""",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
"width": 1024,
|
| 42 |
"height": 1024
|
| 43 |
},
|
| 44 |
{
|
| 45 |
+
"title": "Healthy Lifestyle",
|
| 46 |
+
"prompt": """A watercolor style infographic showing healthy lifestyle tips:
|
| 47 |
+
- Title: "Healthy Lifestyle"
|
| 48 |
+
- 3 pillars: Nutrition, Exercise, Mental Health
|
| 49 |
+
- Icons: Food plate, running shoe, yoga person
|
| 50 |
+
- Soft pastel colors, gentle shapes""",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
"width": 1024,
|
| 52 |
"height": 1024
|
| 53 |
},
|
| 54 |
{
|
| 55 |
+
"title": "E-Commerce Trends",
|
| 56 |
+
"prompt": """A hand-drawn infographic explaining e-commerce market trends:
|
| 57 |
+
- Title: "E-Commerce Trends 2025"
|
| 58 |
+
- Growth chart with arrow
|
| 59 |
+
- 4 key metrics: Conversion Rate, AOV, Repeat Customers, Mobile Share
|
| 60 |
+
- Minimal color scheme, doodle style icons""",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
"width": 1024,
|
| 62 |
"height": 1024
|
| 63 |
},
|
| 64 |
{
|
| 65 |
+
"title": "Planet Sustainability",
|
| 66 |
+
"prompt": """A vivid infographic about environmental sustainability:
|
| 67 |
+
- Title: "Planet Sustainability Goals"
|
| 68 |
+
- Tree diagram with branches: Reduce, Reuse, Recycle
|
| 69 |
+
- Data highlights (CO2 reduction, forest coverage, plastic usage)
|
| 70 |
+
- Green and earthy color scheme""",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
"width": 1024,
|
| 72 |
"height": 1024
|
| 73 |
}
|
|
|
|
| 90 |
height=height,
|
| 91 |
num_inference_steps=num_inference_steps,
|
| 92 |
generator=generator,
|
| 93 |
+
guidance_scale=0.0 # 인포그래픽 텍스트, 레이아웃에 집중
|
| 94 |
).images[0]
|
| 95 |
return image, seed
|
| 96 |
|
| 97 |
+
# CSS 스타일 (기존 구조 유지)
|
| 98 |
css = """
|
| 99 |
.container {
|
| 100 |
display: flex;
|
|
|
|
| 167 |
}
|
| 168 |
"""
|
| 169 |
|
|
|
|
| 170 |
with gr.Blocks(css=css) as demo:
|
| 171 |
gr.Markdown(
|
| 172 |
"""
|
| 173 |
+
<div class="title">GINI Infographic</div>
|
| 174 |
+
<div class="subtitle">Design stunning hand-drawn or modern style infographics with FLUX AI</div>
|
| 175 |
""")
|
| 176 |
|
| 177 |
with gr.Row(equal_height=True):
|
|
|
|
| 179 |
with gr.Column(elem_id="input-column", scale=2):
|
| 180 |
with gr.Group(elem_classes="input-box"):
|
| 181 |
prompt = gr.Text(
|
| 182 |
+
label="Infographic Prompt",
|
| 183 |
+
placeholder="Enter your infographic details...",
|
| 184 |
lines=10,
|
| 185 |
elem_classes="prompt-input"
|
| 186 |
)
|
| 187 |
+
run_button = gr.Button("Generate Infographic", variant="primary")
|
| 188 |
+
result = gr.Image(label="Generated Infographic")
|
| 189 |
|
| 190 |
with gr.Accordion("Advanced Settings", open=False):
|
| 191 |
seed = gr.Slider(
|
|
|
|
| 223 |
|
| 224 |
# 오른쪽 예제 컬럼
|
| 225 |
with gr.Column(elem_id="examples-column", scale=1):
|
| 226 |
+
gr.Markdown("### Example Infographics")
|
| 227 |
for example in EXAMPLES:
|
| 228 |
with gr.Group(elem_classes="example-card"):
|
| 229 |
gr.Markdown(f"#### {example['title']}")
|