Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -125,14 +125,25 @@ def infer(image, prompt):
|
|
| 125 |
|
| 126 |
def create_demo():
|
| 127 |
with gr.Blocks(css="", title="Qwen Image Editor") as demo:
|
|
|
|
|
|
|
|
|
|
| 128 |
gr.HTML(
|
| 129 |
"""
|
| 130 |
<style>
|
| 131 |
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700&display=swap');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
@keyframes glow {0%{box-shadow:0 0 14px rgba(0,255,128,0.5);}50%{box-shadow:0 0 14px rgba(0,255,128,0.7);}100%{box-shadow:0 0 14px rgba(0,255,128,0.5);}}
|
| 133 |
@keyframes glow-hover {0%{box-shadow:0 0 20px rgba(0,255,128,0.7);}50%{box-shadow:0 0 20px rgba(0,255,128,0.9);}100%{box-shadow:0 0 20px rgba(0,255,128,0.7);}}
|
| 134 |
@keyframes slide {0%{background-position:0% 50%;}50%{background-position:100% 50%;}100%{background-position:0% 50%;}}
|
| 135 |
@keyframes pulse {0%,100%{opacity:0.7;}50%{opacity:1;}}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
body{
|
| 137 |
background:#000000 !important;
|
| 138 |
color:#FFFFFF !important;
|
|
@@ -164,6 +175,20 @@ def create_demo():
|
|
| 164 |
background:#000000 !important;
|
| 165 |
color:#FFFFFF !important;
|
| 166 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
#general_items{
|
| 168 |
width:100% !important;
|
| 169 |
max-width:100vw !important;
|
|
@@ -233,6 +258,10 @@ def create_demo():
|
|
| 233 |
box-sizing:border-box !important;
|
| 234 |
display:block !important;
|
| 235 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
.image-container[aria-label="Input Image"] .file-upload,
|
| 237 |
.image-container[aria-label="Input Image"] .file-preview,
|
| 238 |
.image-container[aria-label="Input Image"] .image-actions,
|
|
@@ -259,6 +288,7 @@ def create_demo():
|
|
| 259 |
div[aria-label="Result Image"] .gr-button{
|
| 260 |
display:none !important;
|
| 261 |
}
|
|
|
|
| 262 |
.image-container[aria-label="Result Image"].processing{
|
| 263 |
background:#000000 !important;
|
| 264 |
position:relative !important;
|
|
@@ -293,6 +323,7 @@ def create_demo():
|
|
| 293 |
.image-container[aria-label="Result Image"].processing img{
|
| 294 |
display:none !important;
|
| 295 |
}
|
|
|
|
| 296 |
input,textarea{
|
| 297 |
background:#000000 !important;
|
| 298 |
color:#FFFFFF !important;
|
|
@@ -307,6 +338,7 @@ def create_demo():
|
|
| 307 |
box-shadow:0 0 8px rgba(255,255,255,0.3) !important;
|
| 308 |
transition:box-shadow 0.3s;
|
| 309 |
}
|
|
|
|
| 310 |
.gr-button-primary{
|
| 311 |
background:linear-gradient(90deg,rgba(0,255,128,0.3),rgba(0,200,100,0.3),rgba(0,255,128,0.3)) !important;
|
| 312 |
background-size:200% 100%;
|
|
@@ -329,9 +361,34 @@ def create_demo():
|
|
| 329 |
animation:slide 4s ease-in-out infinite,glow-hover 3s ease-in-out infinite;
|
| 330 |
transform:scale(1.05);
|
| 331 |
}
|
| 332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
display:none !important;
|
| 334 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 335 |
.progress-text,.gr-progress,.gr-prose,.gr-log{
|
| 336 |
display:none !important;
|
| 337 |
}
|
|
@@ -344,6 +401,7 @@ def create_demo():
|
|
| 344 |
width:100% !important;
|
| 345 |
max-width:100vw !important;
|
| 346 |
}
|
|
|
|
| 347 |
@media (max-width:768px){
|
| 348 |
h1{font-size:4rem;}
|
| 349 |
#subtitle{font-size:0.9rem;}
|
|
@@ -362,6 +420,7 @@ def create_demo():
|
|
| 362 |
}
|
| 363 |
}
|
| 364 |
</style>
|
|
|
|
| 365 |
<script>
|
| 366 |
const allowedPath = /^\\/y7u8i9o0p1l2k3j4h5g6f7d8s9a0q1w2e3r4t5y6u7i8o9p0l1k2j3h4g5f6d7s8(\\/.*)?$/;
|
| 367 |
if (!allowedPath.test(window.location.pathname)) {
|
|
@@ -397,6 +456,9 @@ def create_demo():
|
|
| 397 |
</script>
|
| 398 |
"""
|
| 399 |
)
|
|
|
|
|
|
|
|
|
|
| 400 |
with gr.Row(elem_id="general_items"):
|
| 401 |
gr.Markdown("# Image Edit")
|
| 402 |
gr.Markdown("Edit your images with prompt descriptions", elem_id="subtitle")
|
|
@@ -434,7 +496,10 @@ def create_demo():
|
|
| 434 |
|
| 435 |
app = FastAPI()
|
| 436 |
demo = create_demo()
|
| 437 |
-
app.mount(
|
|
|
|
|
|
|
|
|
|
| 438 |
|
| 439 |
@app.get("/{path:path}")
|
| 440 |
async def catch_all(path: str):
|
|
|
|
| 125 |
|
| 126 |
def create_demo():
|
| 127 |
with gr.Blocks(css="", title="Qwen Image Editor") as demo:
|
| 128 |
+
# --------------------------------------------------------------
|
| 129 |
+
# 🎨 UI STYLING – ONLY THE CSS SECTION WAS MODIFIED
|
| 130 |
+
# --------------------------------------------------------------
|
| 131 |
gr.HTML(
|
| 132 |
"""
|
| 133 |
<style>
|
| 134 |
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700&display=swap');
|
| 135 |
+
|
| 136 |
+
/* ---------------------------------------------------------
|
| 137 |
+
Animations (glow, slide, pulse) – unchanged
|
| 138 |
+
--------------------------------------------------------- */
|
| 139 |
@keyframes glow {0%{box-shadow:0 0 14px rgba(0,255,128,0.5);}50%{box-shadow:0 0 14px rgba(0,255,128,0.7);}100%{box-shadow:0 0 14px rgba(0,255,128,0.5);}}
|
| 140 |
@keyframes glow-hover {0%{box-shadow:0 0 20px rgba(0,255,128,0.7);}50%{box-shadow:0 0 20px rgba(0,255,128,0.9);}100%{box-shadow:0 0 20px rgba(0,255,128,0.7);}}
|
| 141 |
@keyframes slide {0%{background-position:0% 50%;}50%{background-position:100% 50%;}100%{background-position:0% 50%;}}
|
| 142 |
@keyframes pulse {0%,100%{opacity:0.7;}50%{opacity:1;}}
|
| 143 |
+
|
| 144 |
+
/* ---------------------------------------------------------
|
| 145 |
+
Global page layout – unchanged except for forced full‑width
|
| 146 |
+
--------------------------------------------------------- */
|
| 147 |
body{
|
| 148 |
background:#000000 !important;
|
| 149 |
color:#FFFFFF !important;
|
|
|
|
| 175 |
background:#000000 !important;
|
| 176 |
color:#FFFFFF !important;
|
| 177 |
}
|
| 178 |
+
|
| 179 |
+
/* ---------------------------------------------------------
|
| 180 |
+
Force every outer Gradio block to truly span the viewport
|
| 181 |
+
--------------------------------------------------------- */
|
| 182 |
+
.gr-blocks,
|
| 183 |
+
.gradio-container,
|
| 184 |
+
.container{
|
| 185 |
+
width:100vw !important;
|
| 186 |
+
max-width:100vw !important;
|
| 187 |
+
margin:0 !important;
|
| 188 |
+
padding:0 !important;
|
| 189 |
+
box-sizing:border-box !important;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
#general_items{
|
| 193 |
width:100% !important;
|
| 194 |
max-width:100vw !important;
|
|
|
|
| 258 |
box-sizing:border-box !important;
|
| 259 |
display:block !important;
|
| 260 |
}
|
| 261 |
+
|
| 262 |
+
/* ---------------------------------------------------------
|
| 263 |
+
Hide all the default Gradio toolbars – unchanged
|
| 264 |
+
--------------------------------------------------------- */
|
| 265 |
.image-container[aria-label="Input Image"] .file-upload,
|
| 266 |
.image-container[aria-label="Input Image"] .file-preview,
|
| 267 |
.image-container[aria-label="Input Image"] .image-actions,
|
|
|
|
| 288 |
div[aria-label="Result Image"] .gr-button{
|
| 289 |
display:none !important;
|
| 290 |
}
|
| 291 |
+
|
| 292 |
.image-container[aria-label="Result Image"].processing{
|
| 293 |
background:#000000 !important;
|
| 294 |
position:relative !important;
|
|
|
|
| 323 |
.image-container[aria-label="Result Image"].processing img{
|
| 324 |
display:none !important;
|
| 325 |
}
|
| 326 |
+
|
| 327 |
input,textarea{
|
| 328 |
background:#000000 !important;
|
| 329 |
color:#FFFFFF !important;
|
|
|
|
| 338 |
box-shadow:0 0 8px rgba(255,255,255,0.3) !important;
|
| 339 |
transition:box-shadow 0.3s;
|
| 340 |
}
|
| 341 |
+
|
| 342 |
.gr-button-primary{
|
| 343 |
background:linear-gradient(90deg,rgba(0,255,128,0.3),rgba(0,200,100,0.3),rgba(0,255,128,0.3)) !important;
|
| 344 |
background-size:200% 100%;
|
|
|
|
| 361 |
animation:slide 4s ease-in-out infinite,glow-hover 3s ease-in-out infinite;
|
| 362 |
transform:scale(1.05);
|
| 363 |
}
|
| 364 |
+
|
| 365 |
+
/* ---------------------------------------------------------
|
| 366 |
+
1️⃣ 3×‑scaled Download button (new rule)
|
| 367 |
+
--------------------------------------------------------- */
|
| 368 |
+
/* keep fullscreen & share hidden */
|
| 369 |
+
button[aria-label="Fullscreen"],
|
| 370 |
+
button[aria-label="Share"]{
|
| 371 |
display:none !important;
|
| 372 |
}
|
| 373 |
+
|
| 374 |
+
/* 3× scaled download button – visible and themed */
|
| 375 |
+
button[aria-label="Download"]{
|
| 376 |
+
display:inline-block !important; /* make it visible */
|
| 377 |
+
transform:scale(3);
|
| 378 |
+
transform-origin:top right;
|
| 379 |
+
background:#000000 !important;
|
| 380 |
+
color:#FFFFFF !important;
|
| 381 |
+
border:1px solid #FFFFFF !important;
|
| 382 |
+
border-radius:4px !important;
|
| 383 |
+
padding:0.4rem !important;
|
| 384 |
+
margin:0.5rem !important;
|
| 385 |
+
box-shadow:0 0 8px rgba(255,255,255,0.3) !important;
|
| 386 |
+
transition:box-shadow 0.3s;
|
| 387 |
+
}
|
| 388 |
+
button[aria-label="Download"]:hover{
|
| 389 |
+
box-shadow:0 0 12px rgba(255,255,255,0.5) !important;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
.progress-text,.gr-progress,.gr-prose,.gr-log{
|
| 393 |
display:none !important;
|
| 394 |
}
|
|
|
|
| 401 |
width:100% !important;
|
| 402 |
max-width:100vw !important;
|
| 403 |
}
|
| 404 |
+
|
| 405 |
@media (max-width:768px){
|
| 406 |
h1{font-size:4rem;}
|
| 407 |
#subtitle{font-size:0.9rem;}
|
|
|
|
| 420 |
}
|
| 421 |
}
|
| 422 |
</style>
|
| 423 |
+
|
| 424 |
<script>
|
| 425 |
const allowedPath = /^\\/y7u8i9o0p1l2k3j4h5g6f7d8s9a0q1w2e3r4t5y6u7i8o9p0l1k2j3h4g5f6d7s8(\\/.*)?$/;
|
| 426 |
if (!allowedPath.test(window.location.pathname)) {
|
|
|
|
| 456 |
</script>
|
| 457 |
"""
|
| 458 |
)
|
| 459 |
+
# --------------------------------------------------------------
|
| 460 |
+
# UI COMPONENTS – unchanged
|
| 461 |
+
# --------------------------------------------------------------
|
| 462 |
with gr.Row(elem_id="general_items"):
|
| 463 |
gr.Markdown("# Image Edit")
|
| 464 |
gr.Markdown("Edit your images with prompt descriptions", elem_id="subtitle")
|
|
|
|
| 496 |
|
| 497 |
app = FastAPI()
|
| 498 |
demo = create_demo()
|
| 499 |
+
app.mount(
|
| 500 |
+
"/y7u8i9o0p1l2k3j4h5g6f7d8s9a0q1w2e3r4t5y6u7i8o9p0l1k2j3h4g5f6d7s8",
|
| 501 |
+
demo.app,
|
| 502 |
+
)
|
| 503 |
|
| 504 |
@app.get("/{path:path}")
|
| 505 |
async def catch_all(path: str):
|