Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -81,11 +81,26 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
81 |
css = """
|
82 |
#col-container {
|
83 |
margin: 0 auto;
|
84 |
-
|
|
|
85 |
padding: 0 1rem;
|
86 |
}
|
87 |
|
88 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
.prompt-input {
|
90 |
min-height: 100px !important;
|
91 |
font-size: 16px !important;
|
@@ -94,6 +109,7 @@ css = """
|
|
94 |
border-radius: 8px !important;
|
95 |
border: 1px solid #e0e0e0 !important;
|
96 |
background-color: #ffffff !important;
|
|
|
97 |
}
|
98 |
|
99 |
.prompt-input:focus {
|
@@ -101,9 +117,8 @@ css = """
|
|
101 |
box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1) !important;
|
102 |
}
|
103 |
|
104 |
-
/*
|
105 |
.generate-button {
|
106 |
-
margin-top: 1rem !important;
|
107 |
padding: 12px 24px !important;
|
108 |
font-size: 16px !important;
|
109 |
font-weight: 600 !important;
|
@@ -111,6 +126,7 @@ css = """
|
|
111 |
background-color: #2196f3 !important;
|
112 |
color: white !important;
|
113 |
transition: all 0.3s ease !important;
|
|
|
114 |
}
|
115 |
|
116 |
.generate-button:hover {
|
@@ -118,8 +134,27 @@ css = """
|
|
118 |
transform: translateY(-1px) !important;
|
119 |
}
|
120 |
|
121 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
@media (max-width: 768px) {
|
|
|
|
|
|
|
|
|
123 |
#col-container {
|
124 |
padding: 0 0.5rem;
|
125 |
}
|
@@ -133,20 +168,15 @@ css = """
|
|
133 |
}
|
134 |
}
|
135 |
|
136 |
-
/*
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
.advanced-settings {
|
146 |
-
margin-top: 2rem;
|
147 |
-
border: 1px solid #e0e0e0;
|
148 |
-
border-radius: 8px;
|
149 |
-
overflow: hidden;
|
150 |
}
|
151 |
"""
|
152 |
|
@@ -157,86 +187,87 @@ with gr.Blocks(css=css) as demo:
|
|
157 |
Using [Noob SDXL beta model](https://huggingface.co/Laxhar) to generate amazing images!
|
158 |
""")
|
159 |
|
160 |
-
with gr.
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
run_button = gr.Button(
|
170 |
-
"✨ Generate Image",
|
171 |
-
elem_classes="generate-button",
|
172 |
-
variant="primary",
|
173 |
-
scale=1,
|
174 |
-
size="lg"
|
175 |
-
)
|
176 |
-
|
177 |
-
result = gr.Image(
|
178 |
-
label="Generated Image",
|
179 |
-
show_label=True,
|
180 |
-
type="filepath",
|
181 |
-
elem_id="output_image"
|
182 |
-
)
|
183 |
-
|
184 |
-
with gr.Accordion("Advanced Settings", open=False, elem_classes="advanced-settings"):
|
185 |
-
negative_prompt = gr.Textbox(
|
186 |
-
label="Negative Prompt",
|
187 |
-
lines=2,
|
188 |
-
placeholder="Specify what you don't want in the image. Example: nsfw, low quality, blur, etc.",
|
189 |
-
value="nsfw, (low quality, worst quality:1.2), very displeasing, 3d, watermark, signature, ugly, poorly drawn"
|
190 |
-
)
|
191 |
-
|
192 |
-
seed = gr.Slider(
|
193 |
-
label="Seed",
|
194 |
-
minimum=0,
|
195 |
-
maximum=MAX_SEED,
|
196 |
-
step=1,
|
197 |
-
value=0,
|
198 |
-
)
|
199 |
-
|
200 |
-
randomize_seed = gr.Checkbox(
|
201 |
-
label="Randomize seed",
|
202 |
-
value=True,
|
203 |
-
info="Generate different results each time"
|
204 |
-
)
|
205 |
-
|
206 |
-
with gr.Row():
|
207 |
-
width = gr.Slider(
|
208 |
-
label="Width",
|
209 |
-
minimum=256,
|
210 |
-
maximum=MAX_IMAGE_SIZE,
|
211 |
-
step=32,
|
212 |
-
value=1024,
|
213 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
maximum=20.0,
|
228 |
-
step=0.1,
|
229 |
-
value=7,
|
230 |
-
info="Controls how closely the image follows the prompt"
|
231 |
)
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
)
|
241 |
|
242 |
run_button.click(
|
|
|
81 |
css = """
|
82 |
#col-container {
|
83 |
margin: 0 auto;
|
84 |
+
width: 100%;
|
85 |
+
max-width: 1200px;
|
86 |
padding: 0 1rem;
|
87 |
}
|
88 |
|
89 |
+
/* デスクトップレイアウト用のグリッド */
|
90 |
+
.desktop-layout {
|
91 |
+
display: grid;
|
92 |
+
grid-template-columns: 1fr 1fr;
|
93 |
+
gap: 2rem;
|
94 |
+
align-items: start;
|
95 |
+
}
|
96 |
+
|
97 |
+
/* プロンプト入力エリア */
|
98 |
+
.prompt-container {
|
99 |
+
display: flex;
|
100 |
+
flex-direction: column;
|
101 |
+
gap: 1rem;
|
102 |
+
}
|
103 |
+
|
104 |
.prompt-input {
|
105 |
min-height: 100px !important;
|
106 |
font-size: 16px !important;
|
|
|
109 |
border-radius: 8px !important;
|
110 |
border: 1px solid #e0e0e0 !important;
|
111 |
background-color: #ffffff !important;
|
112 |
+
resize: vertical !important;
|
113 |
}
|
114 |
|
115 |
.prompt-input:focus {
|
|
|
117 |
box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1) !important;
|
118 |
}
|
119 |
|
120 |
+
/* 生成ボタン */
|
121 |
.generate-button {
|
|
|
122 |
padding: 12px 24px !important;
|
123 |
font-size: 16px !important;
|
124 |
font-weight: 600 !important;
|
|
|
126 |
background-color: #2196f3 !important;
|
127 |
color: white !important;
|
128 |
transition: all 0.3s ease !important;
|
129 |
+
margin: 1rem 0 !important;
|
130 |
}
|
131 |
|
132 |
.generate-button:hover {
|
|
|
134 |
transform: translateY(-1px) !important;
|
135 |
}
|
136 |
|
137 |
+
/* 結果画像 */
|
138 |
+
#output_image {
|
139 |
+
border-radius: 8px;
|
140 |
+
overflow: hidden;
|
141 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
142 |
+
}
|
143 |
+
|
144 |
+
/* アコーディオン */
|
145 |
+
.advanced-settings {
|
146 |
+
border: 1px solid #e0e0e0;
|
147 |
+
border-radius: 8px;
|
148 |
+
overflow: hidden;
|
149 |
+
margin-top: 1rem;
|
150 |
+
}
|
151 |
+
|
152 |
+
/* スマートフォン対応 - 768px以下の画面 */
|
153 |
@media (max-width: 768px) {
|
154 |
+
.desktop-layout {
|
155 |
+
display: block;
|
156 |
+
}
|
157 |
+
|
158 |
#col-container {
|
159 |
padding: 0 0.5rem;
|
160 |
}
|
|
|
168 |
}
|
169 |
}
|
170 |
|
171 |
+
/* タブレット対応 - 768px以上1024px以下の画面 */
|
172 |
+
@media (min-width: 769px) and (max-width: 1024px) {
|
173 |
+
.desktop-layout {
|
174 |
+
gap: 1rem;
|
175 |
+
}
|
176 |
+
|
177 |
+
#col-container {
|
178 |
+
max-width: 900px;
|
179 |
+
}
|
|
|
|
|
|
|
|
|
|
|
180 |
}
|
181 |
"""
|
182 |
|
|
|
187 |
Using [Noob SDXL beta model](https://huggingface.co/Laxhar) to generate amazing images!
|
188 |
""")
|
189 |
|
190 |
+
with gr.Column(elem_classes="desktop-layout"):
|
191 |
+
# 左カラム - 入力コントロール
|
192 |
+
with gr.Column(elem_classes="prompt-container"):
|
193 |
+
prompt = gr.Textbox(
|
194 |
+
label="What would you like to create?",
|
195 |
+
elem_classes="prompt-input",
|
196 |
+
lines=3,
|
197 |
+
placeholder="Describe the image you want to generate. Be specific about details, style, and atmosphere.\n\nExample: 'A serene mountain landscape at sunset, with snow-capped peaks and a clear lake reflection, painted in watercolor style'",
|
198 |
+
show_label=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
)
|
200 |
+
|
201 |
+
with gr.Accordion("Advanced Settings", open=False, elem_classes="advanced-settings"):
|
202 |
+
negative_prompt = gr.Textbox(
|
203 |
+
label="Negative Prompt",
|
204 |
+
lines=2,
|
205 |
+
placeholder="Specify what you don't want in the image",
|
206 |
+
value="nsfw, (low quality, worst quality:1.2), very displeasing, 3d, watermark, signature, ugly, poorly drawn"
|
207 |
+
)
|
208 |
|
209 |
+
with gr.Row():
|
210 |
+
with gr.Column(scale=3):
|
211 |
+
seed = gr.Slider(
|
212 |
+
label="Seed",
|
213 |
+
minimum=0,
|
214 |
+
maximum=MAX_SEED,
|
215 |
+
step=1,
|
216 |
+
value=0,
|
217 |
+
)
|
218 |
+
with gr.Column(scale=1):
|
219 |
+
randomize_seed = gr.Checkbox(
|
220 |
+
label="Randomize",
|
221 |
+
value=True,
|
222 |
+
)
|
223 |
+
|
224 |
+
with gr.Row():
|
225 |
+
width = gr.Slider(
|
226 |
+
label="Width",
|
227 |
+
minimum=256,
|
228 |
+
maximum=MAX_IMAGE_SIZE,
|
229 |
+
step=32,
|
230 |
+
value=1024,
|
231 |
+
)
|
232 |
+
height = gr.Slider(
|
233 |
+
label="Height",
|
234 |
+
minimum=256,
|
235 |
+
maximum=MAX_IMAGE_SIZE,
|
236 |
+
step=32,
|
237 |
+
value=1024,
|
238 |
+
)
|
239 |
+
|
240 |
+
with gr.Row():
|
241 |
+
guidance_scale = gr.Slider(
|
242 |
+
label="Guidance Scale",
|
243 |
+
minimum=0.0,
|
244 |
+
maximum=20.0,
|
245 |
+
step=0.1,
|
246 |
+
value=7,
|
247 |
+
info="Controls how closely the image follows the prompt"
|
248 |
+
)
|
249 |
+
num_inference_steps = gr.Slider(
|
250 |
+
label="Steps",
|
251 |
+
minimum=1,
|
252 |
+
maximum=28,
|
253 |
+
step=1,
|
254 |
+
value=28,
|
255 |
+
info="More steps = higher quality"
|
256 |
+
)
|
257 |
|
258 |
+
run_button = gr.Button(
|
259 |
+
"✨ Generate Image",
|
260 |
+
elem_classes="generate-button",
|
261 |
+
variant="primary",
|
|
|
|
|
|
|
|
|
262 |
)
|
263 |
|
264 |
+
# 右カラム - 生成結果
|
265 |
+
with gr.Column():
|
266 |
+
result = gr.Image(
|
267 |
+
label="Generated Image",
|
268 |
+
show_label=True,
|
269 |
+
type="filepath",
|
270 |
+
elem_id="output_image"
|
271 |
)
|
272 |
|
273 |
run_button.click(
|