Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
comdoleger
commited on
Commit
•
1839681
1
Parent(s):
9349b05
Update app.py
Browse files
app.py
CHANGED
@@ -140,9 +140,9 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
|
|
140 |
if isrmbg:
|
141 |
try:
|
142 |
rmbgfore = rmbg(fore)
|
143 |
-
print(f"Background removed!")
|
144 |
if rmbgfore is not None:
|
145 |
-
fore = rmbgfore
|
|
|
146 |
except:
|
147 |
pass
|
148 |
|
@@ -157,6 +157,7 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
|
|
157 |
if size[0]*size[1]>(1500*1500):
|
158 |
gr.Warning("ℹ️ The input image size is too big, I will lower it!")
|
159 |
image_width, image_height = resize_to_fit((1500,1500), (image_width, image_height))
|
|
|
160 |
|
161 |
|
162 |
|
@@ -167,8 +168,8 @@ def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
|
|
167 |
"prompt" : prompt,
|
168 |
"mode" : mode,
|
169 |
"intensity" : float(intensity),
|
170 |
-
"width" :
|
171 |
-
"height" :
|
172 |
"refprompt" : refprompt
|
173 |
}
|
174 |
print(f"DATA: {data}")
|
@@ -263,6 +264,32 @@ with block:
|
|
263 |
<li>🎨 <strong>Custom Background Control:</strong> Choose or generate backgrounds that perfectly match your creative vision.</li>
|
264 |
<li>⚙️ <strong>Easy Integration:</strong> Integrates smoothly with your existing workflow and tools.</li>
|
265 |
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
</div>
|
267 |
''')
|
268 |
gr.HTML("""
|
|
|
140 |
if isrmbg:
|
141 |
try:
|
142 |
rmbgfore = rmbg(fore)
|
|
|
143 |
if rmbgfore is not None:
|
144 |
+
fore = rmbgfore.convert("RGBA")
|
145 |
+
print(f"Background removed!")
|
146 |
except:
|
147 |
pass
|
148 |
|
|
|
157 |
if size[0]*size[1]>(1500*1500):
|
158 |
gr.Warning("ℹ️ The input image size is too big, I will lower it!")
|
159 |
image_width, image_height = resize_to_fit((1500,1500), (image_width, image_height))
|
160 |
+
fore.resize((1500,1500))
|
161 |
|
162 |
|
163 |
|
|
|
168 |
"prompt" : prompt,
|
169 |
"mode" : mode,
|
170 |
"intensity" : float(intensity),
|
171 |
+
"width" : 1500,
|
172 |
+
"height" : 1500,
|
173 |
"refprompt" : refprompt
|
174 |
}
|
175 |
print(f"DATA: {data}")
|
|
|
264 |
<li>🎨 <strong>Custom Background Control:</strong> Choose or generate backgrounds that perfectly match your creative vision.</li>
|
265 |
<li>⚙️ <strong>Easy Integration:</strong> Integrates smoothly with your existing workflow and tools.</li>
|
266 |
</ul>
|
267 |
+
|
268 |
+
<h2>Step-by-Step Instructions</h2>
|
269 |
+
<p>Follow these instructions to control the generation of backgrounds while keeping the foreground's shape and style consistent:</p>
|
270 |
+
<ul>
|
271 |
+
<li>
|
272 |
+
<span class="emoji">📝</span>
|
273 |
+
<strong>Step 1: Describe the Background</strong>
|
274 |
+
<p>Start by providing a detailed description of the background you want to create.</p>
|
275 |
+
<div class="example">
|
276 |
+
<p><strong>Example:</strong> "A Perfume Bottle nestled on a crystalline cliff of glistening snow, overlooking a serene, moonlit valley."</p>
|
277 |
+
</div>
|
278 |
+
</li>
|
279 |
+
<li>
|
280 |
+
<span class="emoji">💡</span>
|
281 |
+
<strong>Step 2: Describe the Foreground</strong>
|
282 |
+
<p>Next, describe the texture, lighting, and style of the foreground element.</p>
|
283 |
+
<div class="example">
|
284 |
+
<p><strong>Example:</strong> "A transparent glass perfume bottle, vibrant, sunset lighting reflecting off its surface."</p>
|
285 |
+
</div>
|
286 |
+
</li>
|
287 |
+
<li>
|
288 |
+
<span class="emoji">🎚️</span>
|
289 |
+
<strong>Step 3: Adjust the Intensity</strong>
|
290 |
+
<p>Decide how much change you want to apply to the image. Adjust the intensity to balance between keeping consistency and introducing new elements.</p>
|
291 |
+
</li>
|
292 |
+
</ul>
|
293 |
</div>
|
294 |
''')
|
295 |
gr.HTML("""
|