seawolf2357 commited on
Commit
00a3371
ยท
verified ยท
1 Parent(s): b238a96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -25
app.py CHANGED
@@ -16,7 +16,7 @@ if not os.path.exists(SAVE_DIR):
16
 
17
  device = "cuda" if torch.cuda.is_available() else "cpu"
18
  repo_id = "black-forest-labs/FLUX.1-dev"
19
- adapter_id = "openfree/van-gogh" # Changed to van Gogh model
20
 
21
  pipeline = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.bfloat16)
22
  pipeline.load_lora_weights(adapter_id)
@@ -74,22 +74,22 @@ def inference(
74
  # Return just the image and seed
75
  return image, seed
76
 
77
- # Updated examples with 1880s clothing style for Van Gogh
78
  examples = [
79
- "van Gogh's painting of a lively outdoor gathering in the 1880s, with men in formal top hats, frock coats, and women in bustled dresses with elaborate hats, enjoying a summer afternoon. The scene captures the Belle ร‰poque atmosphere with swirling brushstrokes and vibrant colors typical of van Gogh, highlighting the fashionable attire of the period. [trigger]",
80
- "van Gogh's intimate portrait of a young woman from the 1880s, with her hair styled in a fashionable updo, wearing a high-necked dress with lace details and leg-of-mutton sleeves. She wears delicate jewelry and has the expressive, bold brushstrokes and vibrant color palette characteristic of van Gogh's portraiture. [trigger]",
81
- "van Gogh's painting of two young girls in 1880s attire seated at a piano. One plays while the other stands nearby, both dressed in white frocks with ribbon details, sashes, and high collars typical of the period. The interior setting features swirling patterns, intense colors, and the bold impasto technique typical of van Gogh's style. [trigger]",
82
- "van Gogh's painting of an elegant 1880s boating party, with gentlemen in striped boating blazers, straw boater hats, and formal trousers, alongside ladies in bustled day dresses with parasols. The scene captures the leisure activities of French society during the Belle ร‰poque era, rendered with the artist's characteristic swirling brushstrokes and vibrant contrasting colors. [trigger]",
83
- "van Gogh's painting of children playing in an 1880s garden scene, dressed in formal period children's wear including sailor suits for boys and pinafores with full skirts for girls. Their Victorian-era clothing contrasts with their playful activities, set against van Gogh's vibrant treatment of nature with bold, expressive brushstrokes and dramatic color combinations. [trigger]",
84
- "van Gogh's depiction of bathers in 1880s swimming attire, showing the modest bathing costumes of the period. Women wear full-coverage dark bathing dresses with stockings, while men are in knee-length swimming suits. The figures are arranged against a backdrop of water and landscape rendered in van Gogh's distinctive swirling brushwork and bold chromatic contrasts. [trigger]"
85
  ]
86
 
87
- # Improved custom CSS with better visuals - updated colors for Van Gogh theme
88
  custom_css = """
89
  :root {
90
- --color-primary: #1A3A8F;
91
- --color-secondary: #E09900;
92
- --background-fill-primary: linear-gradient(to right, #f6f9fc, #f0f4e3);
93
  }
94
 
95
  footer {
@@ -146,6 +146,7 @@ footer {
146
  button.primary {
147
  background-color: var(--color-primary) !important;
148
  transition: all 0.3s ease;
 
149
  }
150
 
151
  button:hover {
@@ -156,6 +157,9 @@ button:hover {
156
  .input-container {
157
  border-radius: 10px;
158
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
 
 
 
159
  }
160
 
161
  .advanced-settings {
@@ -174,23 +178,29 @@ button:hover {
174
  """
175
 
176
  with gr.Blocks(css=custom_css, analytics_enabled=False) as demo:
177
- gr.HTML('<div class="title">Vincent van Gogh STUDIO</div>')
178
 
179
- # Add collection link below title
180
- gr.HTML('<div class="collection-link"><a href="https://huggingface.co/collections/openfree/painting-art-ai-681453484ec15ef5978bbeb1" target="_blank">View the full Painting Art AI Collection</a></div>')
181
 
182
- # Model description with the requested content
183
  with gr.Group(elem_classes="model-description"):
184
- gr.HTML('<p>Generate beautiful artwork in the style of Vincent van Gogh. Add [trigger] at the end of your prompt for best results.</p>')
 
 
 
 
 
 
185
 
186
- # Simplified structure without tabs and gallery
187
  with gr.Column(elem_id="col-container"):
188
  with gr.Row(elem_classes="input-container"):
189
  prompt = gr.Text(
190
  label="Prompt",
191
  max_lines=1,
192
  placeholder="Enter your prompt (add [trigger] at the end)",
193
- value=examples[0] # Set default text instead of generating an image
194
  )
195
  run_button = gr.Button("Generate", variant="primary", scale=0)
196
 
@@ -252,11 +262,11 @@ with gr.Blocks(css=custom_css, analytics_enabled=False) as demo:
252
  examples=examples,
253
  inputs=prompt,
254
  outputs=None, # Don't auto-run examples
255
- fn=None, # No function to run for examples - just fill the prompt
256
- cache_examples=False, # Disable caching
257
  )
258
 
259
- # Event handlers
260
  gr.on(
261
  triggers=[run_button.click, prompt.submit],
262
  fn=inference,
@@ -272,8 +282,6 @@ with gr.Blocks(css=custom_css, analytics_enabled=False) as demo:
272
  ],
273
  outputs=[result, seed_output],
274
  )
275
-
276
- # No preloading or automatic image generation
277
 
278
  demo.queue()
279
- demo.launch()
 
16
 
17
  device = "cuda" if torch.cuda.is_available() else "cpu"
18
  repo_id = "black-forest-labs/FLUX.1-dev"
19
+ adapter_id = "seawolf2357/kim-korea" # ํŠน์ • ์ •์น˜์ธ์„ ํ•™์Šตํ•œ LoRA ๋ชจ๋ธ
20
 
21
  pipeline = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.bfloat16)
22
  pipeline.load_lora_weights(adapter_id)
 
74
  # Return just the image and seed
75
  return image, seed
76
 
77
+ # ์˜ˆ์‹œ ๋ฌธ๊ตฌ: ํŠน์ • ์ •์น˜์ธ Mr. KIM์˜ ๋‹ค์–‘ํ•œ ์ƒํ™ฉ์„ ๋ฌ˜์‚ฌ
78
  examples = [
79
+ "Mr. KIM delivering a powerful speech in front of a large crowd with confident gestures and determined expression. [trigger]",
80
+ "Mr. KIM attending an international summit, standing among other world leaders with a dignified and poised manner. [trigger]",
81
+ "Mr. KIM holding a press conference, facing flashing cameras, wearing a tailored suit and a subtle lapel pin. [trigger]",
82
+ "Mr. KIM visiting a rural area, warmly greeting local residents while discussing policies and improvements. [trigger]",
83
+ "Mr. KIM in a dynamic interview setting, passionately outlining his visions for the future. [trigger]",
84
+ "Mr. KIM preparing for an important debate, surrounded by paperwork, looking focused and resolute. [trigger]",
85
  ]
86
 
87
+ # UI๋ฅผ ๋ถ‰์€ ๊ณ„์—ด ๊ทธ๋ผ๋””์—์ด์…˜์œผ๋กœ ๋””์ž์ธ
88
  custom_css = """
89
  :root {
90
+ --color-primary: #8F1A3A; /* ๋ถ‰์€ ํ†ค์˜ ๋ฉ”์ธ ์ปฌ๋Ÿฌ */
91
+ --color-secondary: #FF4B4B; /* ํฌ์ธํŠธ ์ปฌ๋Ÿฌ(๋ฐ์€ ๋นจ๊ฐ•) */
92
+ --background-fill-primary: linear-gradient(to right, #FFF5F5, #FED7D7, #FEB2B2);
93
  }
94
 
95
  footer {
 
146
  button.primary {
147
  background-color: var(--color-primary) !important;
148
  transition: all 0.3s ease;
149
+ color: #fff !important;
150
  }
151
 
152
  button:hover {
 
157
  .input-container {
158
  border-radius: 10px;
159
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
160
+ background-color: rgba(255, 255, 255, 0.6);
161
+ padding: 20px;
162
+ margin-bottom: 1rem;
163
  }
164
 
165
  .advanced-settings {
 
178
  """
179
 
180
  with gr.Blocks(css=custom_css, analytics_enabled=False) as demo:
181
+ gr.HTML('<div class="title">Mr. KIM in KOREA</div>')
182
 
183
+ # ์ปฌ๋ ‰์…˜ ๏ฟฝ๏ฟฝ๏ฟฝํฌ ๋˜๋Š” ์•ˆ๋‚ด๋ฌธ์„ ํ•„์š” ์‹œ ์ˆ˜์ •/์‚ญ์ œ
184
+ gr.HTML('<div class="collection-link"><a href="https://huggingface.co/collections/openfree/painting-art-ai-681453484ec15ef5978bbeb1" target="_blank">Visit the LoRA Model Collection</a></div>')
185
 
186
+ # ๋ชจ๋ธ ์„ค๋ช…: ํŠน์ • ์ •์น˜์ธ์— ๋Œ€ํ•œ LoRA ๋ชจ๋ธ์ž„์„ ์–ธ๊ธ‰
187
  with gr.Group(elem_classes="model-description"):
188
+ gr.HTML("""
189
+ <p>
190
+ ๋ณธ ๋ชจ๋ธ์€ ํŠน์ • ์ •์น˜์ธ์˜ ์–ผ๊ตด๊ณผ ์™ธ๋ชจ๋ฅผ ํ•™์Šตํ•œ LoRA ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค.<br>
191
+ ๊ฐœ์ธ ์‚ฌ์ง„ ๋“ฑ์„ ๋ฌด๋‹จ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋„๋ก ์œ ์˜ํ•ด ์ฃผ์„ธ์š”.<br>
192
+ (์˜ˆ์‹œ prompt ์‚ฌ์šฉ ์‹œ [trigger]๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ์ตœ์ ์˜ ๊ฒฐ๊ณผ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.)
193
+ </p>
194
+ """)
195
 
196
+ # ๋ฉ”์ธ UI
197
  with gr.Column(elem_id="col-container"):
198
  with gr.Row(elem_classes="input-container"):
199
  prompt = gr.Text(
200
  label="Prompt",
201
  max_lines=1,
202
  placeholder="Enter your prompt (add [trigger] at the end)",
203
+ value=examples[0] # ๊ธฐ๋ณธ ์˜ˆ์‹œ
204
  )
205
  run_button = gr.Button("Generate", variant="primary", scale=0)
206
 
 
262
  examples=examples,
263
  inputs=prompt,
264
  outputs=None, # Don't auto-run examples
265
+ fn=None, # No function to run for examples - just fill the prompt
266
+ cache_examples=False,
267
  )
268
 
269
+ # ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ
270
  gr.on(
271
  triggers=[run_button.click, prompt.submit],
272
  fn=inference,
 
282
  ],
283
  outputs=[result, seed_output],
284
  )
 
 
285
 
286
  demo.queue()
287
+ demo.launch()