fantos commited on
Commit
c43703f
β€’
1 Parent(s): 6960db5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +78 -74
app.py CHANGED
@@ -73,96 +73,100 @@ def load_example():
73
  example_image = Image.open(example_image_path)
74
  return example_prompt, example_cfg_scale, example_steps, True, example_seed, example_width, example_height, example_lora_scale, example_image
75
 
 
76
  css = """
77
- .container {max-width: 1200px; margin: auto; padding: 20px;}
78
  .header {text-align: center; margin-bottom: 30px;}
79
- .generate-btn {background-color: #2ecc71 !important; color: white !important;}
80
  .generate-btn:hover {background-color: #27ae60 !important;}
81
  .parameter-box {background-color: #f5f6fa; padding: 20px; border-radius: 10px; margin: 10px 0;}
82
- .result-box {background-color: #f5f6fa; padding: 20px; border-radius: 10px;}
 
 
83
  """
84
 
85
  with gr.Blocks(css=css) as app:
86
  with gr.Column(elem_classes="container"):
87
  gr.Markdown("# 🎨 Flux ART Image Generator", elem_classes="header")
88
 
89
- with gr.Row(equal_height=True):
90
- with gr.Column(scale=3):
91
- with gr.Group(elem_classes="parameter-box"):
92
- prompt = gr.TextArea(
93
- label="✍️ Your Prompt (ν•œκΈ€ λ˜λŠ” μ˜μ–΄)",
94
- placeholder="이미지λ₯Ό μ„€λͺ…ν•˜μ„Έμš”... (ν•œκΈ€ μž…λ ₯μ‹œ μžλ™μœΌλ‘œ μ˜μ–΄λ‘œ λ²ˆμ—­λ©λ‹ˆλ‹€)",
95
- lines=5
96
- )
97
-
98
- with gr.Group(elem_classes="parameter-box"):
99
- gr.Markdown("### πŸŽ›οΈ Generation Parameters")
100
- with gr.Row():
101
- with gr.Column():
102
- cfg_scale = gr.Slider(
103
- label="CFG Scale",
104
- minimum=1,
105
- maximum=20,
106
- step=0.5,
107
- value=example_cfg_scale
108
- )
109
- steps = gr.Slider(
110
- label="Steps",
111
- minimum=1,
112
- maximum=100,
113
- step=1,
114
- value=example_steps
115
- )
116
- lora_scale = gr.Slider(
117
- label="LoRA Scale",
118
- minimum=0,
119
- maximum=1,
120
- step=0.01,
121
- value=example_lora_scale
122
- )
123
 
124
- with gr.Group(elem_classes="parameter-box"):
125
- gr.Markdown("### πŸ“ Image Dimensions")
126
- with gr.Row():
127
- width = gr.Slider(
128
- label="Width",
129
- minimum=256,
130
- maximum=1536,
131
- step=64,
132
- value=example_width
133
- )
134
- height = gr.Slider(
135
- label="Height",
136
- minimum=256,
137
- maximum=1536,
138
- step=64,
139
- value=example_height
140
  )
141
-
142
- with gr.Group(elem_classes="parameter-box"):
143
- gr.Markdown("### 🎲 Seed Settings")
144
- with gr.Row():
145
- randomize_seed = gr.Checkbox(
146
- True,
147
- label="Randomize seed"
148
  )
149
- seed = gr.Slider(
150
- label="Seed",
151
  minimum=0,
152
- maximum=MAX_SEED,
153
- step=1,
154
- value=example_seed
155
  )
156
-
157
- generate_button = gr.Button(
158
- "πŸš€ Generate Image",
159
- elem_classes="generate-btn"
160
- )
161
 
162
- with gr.Column(scale=2):
163
- with gr.Group(elem_classes="result-box"):
164
- gr.Markdown("### πŸ–ΌοΈ Generated Image")
165
- result = gr.Image(label="Result")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
 
167
  app.load(
168
  load_example,
 
73
  example_image = Image.open(example_image_path)
74
  return example_prompt, example_cfg_scale, example_steps, True, example_seed, example_width, example_height, example_lora_scale, example_image
75
 
76
+
77
  css = """
78
+ .container {max-width: 1400px; margin: auto; padding: 20px;}
79
  .header {text-align: center; margin-bottom: 30px;}
80
+ .generate-btn {background-color: #2ecc71 !important; color: white !important; margin: 20px auto !important; display: block !important; width: 200px !important;}
81
  .generate-btn:hover {background-color: #27ae60 !important;}
82
  .parameter-box {background-color: #f5f6fa; padding: 20px; border-radius: 10px; margin: 10px 0;}
83
+ .result-box {background-color: #f5f6fa; padding: 20px; border-radius: 10px; margin: 0 auto 20px auto; text-align: center;}
84
+ .image-output {margin: 0 auto; display: block; max-width: 800px !important;}
85
+ .accordion {margin-top: 20px;}
86
  """
87
 
88
  with gr.Blocks(css=css) as app:
89
  with gr.Column(elem_classes="container"):
90
  gr.Markdown("# 🎨 Flux ART Image Generator", elem_classes="header")
91
 
92
+ # 이미지 좜λ ₯ μ˜μ—­μ„ λ¨Όμ € 배치
93
+ with gr.Group(elem_classes="result-box"):
94
+ gr.Markdown("### πŸ–ΌοΈ Generated Image")
95
+ result = gr.Image(label="Result", elem_classes="image-output")
96
+
97
+ # 생성 λ²„νŠΌ
98
+ generate_button = gr.Button(
99
+ "πŸš€ Generate Image",
100
+ elem_classes="generate-btn"
101
+ )
102
+
103
+ # μ˜΅μ…˜λ“€μ„ μ•„μ½”λ””μ–ΈμœΌλ‘œ ꡬ성
104
+ with gr.Accordion("🎨 Generation Options", open=False, elem_classes="accordion"):
105
+ with gr.Group(elem_classes="parameter-box"):
106
+ prompt = gr.TextArea(
107
+ label="✍️ Your Prompt (ν•œκΈ€ λ˜λŠ” μ˜μ–΄)",
108
+ placeholder="이미지λ₯Ό μ„€λͺ…ν•˜μ„Έμš”... (ν•œκΈ€ μž…λ ₯μ‹œ μžλ™μœΌλ‘œ μ˜μ–΄λ‘œ λ²ˆμ—­λ©λ‹ˆλ‹€)",
109
+ lines=5
110
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
+ with gr.Group(elem_classes="parameter-box"):
113
+ gr.Markdown("### πŸŽ›οΈ Generation Parameters")
114
+ with gr.Row():
115
+ with gr.Column():
116
+ cfg_scale = gr.Slider(
117
+ label="CFG Scale",
118
+ minimum=1,
119
+ maximum=20,
120
+ step=0.5,
121
+ value=example_cfg_scale
 
 
 
 
 
 
122
  )
123
+ steps = gr.Slider(
124
+ label="Steps",
125
+ minimum=1,
126
+ maximum=100,
127
+ step=1,
128
+ value=example_steps
 
129
  )
130
+ lora_scale = gr.Slider(
131
+ label="LoRA Scale",
132
  minimum=0,
133
+ maximum=1,
134
+ step=0.01,
135
+ value=example_lora_scale
136
  )
 
 
 
 
 
137
 
138
+ with gr.Group(elem_classes="parameter-box"):
139
+ gr.Markdown("### πŸ“ Image Dimensions")
140
+ with gr.Row():
141
+ width = gr.Slider(
142
+ label="Width",
143
+ minimum=256,
144
+ maximum=1536,
145
+ step=64,
146
+ value=example_width
147
+ )
148
+ height = gr.Slider(
149
+ label="Height",
150
+ minimum=256,
151
+ maximum=1536,
152
+ step=64,
153
+ value=example_height
154
+ )
155
+
156
+ with gr.Group(elem_classes="parameter-box"):
157
+ gr.Markdown("### 🎲 Seed Settings")
158
+ with gr.Row():
159
+ randomize_seed = gr.Checkbox(
160
+ True,
161
+ label="Randomize seed"
162
+ )
163
+ seed = gr.Slider(
164
+ label="Seed",
165
+ minimum=0,
166
+ maximum=MAX_SEED,
167
+ step=1,
168
+ value=example_seed
169
+ )
170
 
171
  app.load(
172
  load_example,