ginipick commited on
Commit
ffe8446
ยท
verified ยท
1 Parent(s): 3ce2990

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +80 -15
app.py CHANGED
@@ -59,7 +59,7 @@ MAX_SEED = np.iinfo(np.int32).max
59
  MAX_IMAGE_SIZE = 1024
60
 
61
  # ----------------------------------------------
62
- # ์ˆ˜์ •๋œ ๋ถ€๋ถ„: infer ํ•จ์ˆ˜ ๋‚ด์—์„œ hidden_prompt๋ฅผ ์•ž์— ์ถ”๊ฐ€
63
  # ----------------------------------------------
64
  @spaces.GPU(duration=80)
65
  def infer(
@@ -134,7 +134,6 @@ examples = [
134
  "gh4.jpg",
135
  0.5
136
  ],
137
-
138
  [
139
  "sunglass",
140
  "gh1.jpg",
@@ -142,35 +141,98 @@ examples = [
142
  ],
143
  ]
144
 
 
 
 
145
  css = """
 
 
 
 
 
 
 
 
146
  #col-container {
147
- margin: 0 auto;
148
  max-width: 720px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  }
150
- #result img{
 
151
  object-position: top;
 
 
 
 
 
152
  }
153
- #result .image-container{
154
- height: 100%
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  }
156
  """
157
 
158
  with gr.Blocks(css=css) as demo:
159
  with gr.Column(elem_id="col-container"):
160
- gr.Markdown(f"""
161
- # Beyond Ghibli Reimagined
162
- """)
163
 
164
- with gr.Row():
 
165
  prompt = gr.Text(
166
  label="Prompt",
167
  show_label=False,
168
  max_lines=1,
169
  placeholder="Enter your prompt",
170
- container=False,
171
  )
172
- run_button = gr.Button("Run", scale=0)
173
 
 
174
  with gr.Row():
175
  with gr.Column():
176
  ip_adapter_image = gr.Image(label="IP-Adapter Image", type="pil")
@@ -184,10 +246,11 @@ with gr.Blocks(css=css) as demo:
184
  )
185
  result = gr.Image(label="Result", elem_id="result")
186
 
187
- with gr.Accordion("Advanced Settings", open=False):
 
188
  negative_prompt = gr.Text(
189
  label="Negative prompt",
190
- max_lines=1,
191
  placeholder=(
192
  "Copy(worst quality, low quality:1.4), bad anatomy, bad hands, text, error, "
193
  "missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, "
@@ -234,7 +297,8 @@ with gr.Blocks(css=css) as demo:
234
  step=1,
235
  value=50,
236
  )
237
-
 
238
  gr.Examples(
239
  examples=examples,
240
  fn=infer,
@@ -243,6 +307,7 @@ with gr.Blocks(css=css) as demo:
243
  cache_examples="lazy"
244
  )
245
 
 
246
  gr.on(
247
  triggers=[run_button.click, prompt.submit],
248
  fn=infer,
 
59
  MAX_IMAGE_SIZE = 1024
60
 
61
  # ----------------------------------------------
62
+ # infer ํ•จ์ˆ˜ (๊ธฐ์กด ๋กœ์ง ๊ทธ๋Œ€๋กœ ์œ ์ง€)
63
  # ----------------------------------------------
64
  @spaces.GPU(duration=80)
65
  def infer(
 
134
  "gh4.jpg",
135
  0.5
136
  ],
 
137
  [
138
  "sunglass",
139
  "gh1.jpg",
 
141
  ],
142
  ]
143
 
144
+ # --------------------------
145
+ # ๊ฐœ์„ ๋œ UI๋ฅผ ์œ„ํ•œ CSS
146
+ # --------------------------
147
  css = """
148
+ body {
149
+ background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
150
+ font-family: 'Helvetica Neue', Arial, sans-serif;
151
+ color: #333;
152
+ margin: 0;
153
+ padding: 0;
154
+ }
155
+
156
  #col-container {
157
+ margin: 0 auto !important;
158
  max-width: 720px;
159
+ background: rgba(255,255,255,0.85);
160
+ border-radius: 16px;
161
+ padding: 2rem;
162
+ box-shadow: 0 8px 24px rgba(0,0,0,0.1);
163
+ }
164
+
165
+ #header-title {
166
+ text-align: center;
167
+ font-size: 2rem;
168
+ font-weight: bold;
169
+ margin-bottom: 1rem;
170
+ }
171
+
172
+ #prompt-row {
173
+ display: flex;
174
+ gap: 0.5rem;
175
+ align-items: center;
176
+ margin-bottom: 1rem;
177
+ }
178
+
179
+ #prompt-text {
180
+ flex: 1;
181
  }
182
+
183
+ #result img {
184
  object-position: top;
185
+ border-radius: 8px;
186
+ }
187
+
188
+ #result .image-container {
189
+ height: 100%;
190
  }
191
+
192
+ .gr-button {
193
+ background-color: #2E8BFB !important;
194
+ color: white !important;
195
+ border: none !important;
196
+ transition: background-color 0.2s ease;
197
+ }
198
+
199
+ .gr-button:hover {
200
+ background-color: #186EDB !important;
201
+ }
202
+
203
+ .gr-slider input[type=range] {
204
+ accent-color: #2E8BFB !important;
205
+ }
206
+
207
+ .gr-box {
208
+ background-color: #fafafa !important;
209
+ border: 1px solid #ddd !important;
210
+ border-radius: 8px !important;
211
+ padding: 1rem !important;
212
+ }
213
+
214
+ #advanced-settings {
215
+ margin-top: 1rem;
216
+ border-radius: 8px;
217
  }
218
  """
219
 
220
  with gr.Blocks(css=css) as demo:
221
  with gr.Column(elem_id="col-container"):
222
+ gr.Markdown("<div id='header-title'>Beyond Ghibli Reimagined</div>")
 
 
223
 
224
+ # ์ƒ๋‹จ: ํ”„๋กฌํ”„ํŠธ ์ž…๋ ฅ + ์‹คํ–‰ ๋ฒ„ํŠผ
225
+ with gr.Row(elem_id="prompt-row"):
226
  prompt = gr.Text(
227
  label="Prompt",
228
  show_label=False,
229
  max_lines=1,
230
  placeholder="Enter your prompt",
231
+ elem_id="prompt-text",
232
  )
233
+ run_button = gr.Button("Run", elem_id="run-button")
234
 
235
+ # ๊ฐ€์šด๋ฐ: ์ด๋ฏธ์ง€ ์ž…๋ ฅ๊ณผ ์Šฌ๋ผ์ด๋”, ๊ฒฐ๊ณผ ์ด๋ฏธ์ง€
236
  with gr.Row():
237
  with gr.Column():
238
  ip_adapter_image = gr.Image(label="IP-Adapter Image", type="pil")
 
246
  )
247
  result = gr.Image(label="Result", elem_id="result")
248
 
249
+ # ํ•˜๋‹จ: ๊ณ ๊ธ‰ ์„ค์ •(Accordion)
250
+ with gr.Accordion("Advanced Settings", open=False, elem_id="advanced-settings"):
251
  negative_prompt = gr.Text(
252
  label="Negative prompt",
253
+ max_lines=2,
254
  placeholder=(
255
  "Copy(worst quality, low quality:1.4), bad anatomy, bad hands, text, error, "
256
  "missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, "
 
297
  step=1,
298
  value=50,
299
  )
300
+
301
+ # ์˜ˆ์‹œ๋“ค
302
  gr.Examples(
303
  examples=examples,
304
  fn=infer,
 
307
  cache_examples="lazy"
308
  )
309
 
310
+ # ๋ฒ„ํŠผ ํด๋ฆญ/ํ”„๋กฌํ”„ํŠธ ์—”ํ„ฐ ์‹œ ์‹คํ–‰
311
  gr.on(
312
  triggers=[run_button.click, prompt.submit],
313
  fn=infer,