Update app.py
Browse files
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 = "
|
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 |
-
#
|
78 |
examples = [
|
79 |
-
"
|
80 |
-
"
|
81 |
-
"
|
82 |
-
"
|
83 |
-
"
|
84 |
-
"
|
85 |
]
|
86 |
|
87 |
-
#
|
88 |
custom_css = """
|
89 |
:root {
|
90 |
-
--color-primary: #
|
91 |
-
--color-secondary: #
|
92 |
-
--background-fill-primary: linear-gradient(to right, #
|
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">
|
178 |
|
179 |
-
#
|
180 |
-
gr.HTML('<div class="collection-link"><a href="https://huggingface.co/collections/openfree/painting-art-ai-681453484ec15ef5978bbeb1" target="_blank">
|
181 |
|
182 |
-
#
|
183 |
with gr.Group(elem_classes="model-description"):
|
184 |
-
gr.HTML(
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
|
186 |
-
#
|
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] #
|
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,
|
256 |
-
cache_examples=False,
|
257 |
)
|
258 |
|
259 |
-
#
|
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()
|