Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -280,8 +280,72 @@ class Stage(Enum):
|
|
| 280 |
SECOND_STAGE = "refiner"
|
| 281 |
FULL = "full"
|
| 282 |
|
| 283 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
}
|
| 286 |
|
| 287 |
#share-btn-container {
|
|
@@ -291,8 +355,8 @@ css="""#disp_image {
|
|
| 291 |
justify-content: center;
|
| 292 |
align-items: center;
|
| 293 |
border-radius: 9999px !important;
|
| 294 |
-
max-width:
|
| 295 |
-
margin
|
| 296 |
}
|
| 297 |
|
| 298 |
#share-btn-container > div {
|
|
@@ -340,62 +404,7 @@ css="""#disp_image {
|
|
| 340 |
background: #1565c0;
|
| 341 |
}
|
| 342 |
|
| 343 |
-
|
| 344 |
-
font-family: Arial, sans-serif;
|
| 345 |
-
background-color: #f4f4f9;
|
| 346 |
-
margin: 0;
|
| 347 |
-
padding: 0;
|
| 348 |
-
display: flex;
|
| 349 |
-
flex-direction: column;
|
| 350 |
-
justify-content: center;
|
| 351 |
-
align-items: center;
|
| 352 |
-
min-height: 100vh;
|
| 353 |
-
color: #333;
|
| 354 |
-
}
|
| 355 |
-
|
| 356 |
-
.custom-button {
|
| 357 |
-
background: linear-gradient(271.15deg, #00C7E2 0.27%, #00CC6A 48.52%, #70FF00 102.07%);
|
| 358 |
-
font-size: 30px;
|
| 359 |
-
color: white;
|
| 360 |
-
padding: 10px 20px;
|
| 361 |
-
border: none;
|
| 362 |
-
border-radius: 5px;
|
| 363 |
-
cursor: pointer;
|
| 364 |
-
transition: opacity 0.3s ease;
|
| 365 |
-
}
|
| 366 |
-
|
| 367 |
-
.custom-button:hover {
|
| 368 |
-
opacity: 0.8;
|
| 369 |
-
}
|
| 370 |
-
|
| 371 |
-
.custom-title {
|
| 372 |
-
font-size: 36px;
|
| 373 |
-
background: linear-gradient(271.15deg, #00C7E2 0.27%, #12C06D 102.07%);
|
| 374 |
-
-webkit-background-clip: text;
|
| 375 |
-
-webkit-text-fill-color: transparent;
|
| 376 |
-
font-weight: bold;
|
| 377 |
-
text-align: center;
|
| 378 |
-
margin-bottom: 20px;
|
| 379 |
-
}
|
| 380 |
-
|
| 381 |
-
h1 {
|
| 382 |
-
color: #222222;
|
| 383 |
-
}
|
| 384 |
-
|
| 385 |
-
a {
|
| 386 |
-
color: #4a90e2;
|
| 387 |
-
text-decoration: none;
|
| 388 |
-
font-weight: bold;
|
| 389 |
-
}
|
| 390 |
-
|
| 391 |
-
a:hover {
|
| 392 |
-
text-decoration: underline;
|
| 393 |
-
}
|
| 394 |
-
|
| 395 |
-
.emoji {
|
| 396 |
-
font-size: 1.5em;
|
| 397 |
-
}
|
| 398 |
-
|
| 399 |
@media (max-width: 768px) {
|
| 400 |
.custom-button {
|
| 401 |
font-size: 20px;
|
|
@@ -406,11 +415,7 @@ a:hover {
|
|
| 406 |
font-size: 28px;
|
| 407 |
}
|
| 408 |
|
| 409 |
-
|
| 410 |
-
padding: 0 1rem;
|
| 411 |
-
}
|
| 412 |
-
|
| 413 |
-
h1 {
|
| 414 |
font-size: 24px;
|
| 415 |
}
|
| 416 |
}
|
|
@@ -425,11 +430,7 @@ a:hover {
|
|
| 425 |
font-size: 22px;
|
| 426 |
}
|
| 427 |
|
| 428 |
-
|
| 429 |
-
padding: 0 0.5rem;
|
| 430 |
-
}
|
| 431 |
-
|
| 432 |
-
h1 {
|
| 433 |
font-size: 20px;
|
| 434 |
}
|
| 435 |
|
|
@@ -438,12 +439,17 @@ a:hover {
|
|
| 438 |
padding: 0.5rem;
|
| 439 |
}
|
| 440 |
}
|
| 441 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 442 |
block = gr.Blocks(css=css, title="## F.ai Fuzer").queue()
|
| 443 |
with block:
|
| 444 |
-
gr.HTML(''
|
| 445 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 446 |
-
''') # Add the viewport meta tag here
|
| 447 |
|
| 448 |
gr.HTML('''
|
| 449 |
<div class="container">
|
|
@@ -471,11 +477,12 @@ with block:
|
|
| 471 |
</ul>
|
| 472 |
</div>
|
| 473 |
''')
|
|
|
|
| 474 |
gr.HTML('<center><h2><a href="https://api-dashboard.fotographer.ai/login.html">🔗 Check out our API!</a></h2></center>')
|
| 475 |
|
| 476 |
with gr.Row():
|
| 477 |
gr.Markdown("### F.ai Fuzer: Real Composite Photography in 2 minutes!")
|
| 478 |
-
|
| 479 |
with gr.Row():
|
| 480 |
fore = gr.Image(image_mode='RGBA', type="pil", label="Foreground Image", height=400, width=400)
|
| 481 |
with gr.Column():
|
|
@@ -489,16 +496,7 @@ with block:
|
|
| 489 |
with gr.Row():
|
| 490 |
mode = gr.Radio(choices=[e.value for e in Stage], value=Stage.FULL.value, label="Generation Mode", type='value')
|
| 491 |
mode.change(fn=update_value, inputs=mode, outputs=mode)
|
| 492 |
-
|
| 493 |
-
with gr.Column():
|
| 494 |
-
gr.HTML('''
|
| 495 |
-
<div class="container">
|
| 496 |
-
<h1>🚀 For more freedom of usage, check out our API</h1>
|
| 497 |
-
<p>👤 You can test with free credits:</p>
|
| 498 |
-
<h2><a href="https://api-dashboard.fotographer.ai/login.html">🔗 API Dashboard</a></h2>
|
| 499 |
-
</div>
|
| 500 |
-
''')
|
| 501 |
-
|
| 502 |
with gr.Row():
|
| 503 |
intensity = gr.Slider(label="Refiner Strength", minimum=1.0, maximum=7.0, value=3.0, step=0.5)
|
| 504 |
intensity.change(fn=update_value, inputs=intensity, outputs=intensity)
|
|
@@ -517,10 +515,8 @@ with block:
|
|
| 517 |
</ul>
|
| 518 |
''')
|
| 519 |
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
<center><h2><a href="https://fotographer.ai/">🔗 Check Out our other Projects Here!</a></h2></center>""")
|
| 523 |
-
|
| 524 |
with gr.Row():
|
| 525 |
dummy_image_for_outputs = gr.Image(visible=False, label='Result', height=400, width=400)
|
| 526 |
gr.Examples(
|
|
@@ -529,24 +525,10 @@ with block:
|
|
| 529 |
inputs=[
|
| 530 |
fore, prompt, intensity, mode, refprompt, isrmbg, dummy_image_for_outputs
|
| 531 |
]
|
| 532 |
-
|
| 533 |
)
|
| 534 |
-
'''
|
| 535 |
-
with gr.Column():
|
| 536 |
-
dummy_image_for_outputs = gr.Image(visible=False, label='Result')
|
| 537 |
-
gr.Examples(
|
| 538 |
-
examples=outputs_list,
|
| 539 |
-
inputs=[dummy_image_for_outputs],
|
| 540 |
-
|
| 541 |
-
)
|
| 542 |
-
'''
|
| 543 |
-
|
| 544 |
-
|
| 545 |
|
| 546 |
ins = [fore, prompt, intensity, mode, refprompt, isrmbg]
|
| 547 |
generate_button.click(fn=process_generate, inputs=ins, outputs=[result_gallery])
|
| 548 |
|
| 549 |
-
|
| 550 |
-
|
| 551 |
block.launch()
|
| 552 |
|
|
|
|
| 280 |
SECOND_STAGE = "refiner"
|
| 281 |
FULL = "full"
|
| 282 |
|
| 283 |
+
# CSS for styling
|
| 284 |
+
css = """
|
| 285 |
+
/* General Styles */
|
| 286 |
+
body {
|
| 287 |
+
font-family: Arial, sans-serif;
|
| 288 |
+
background-color: #f4f4f9;
|
| 289 |
+
margin: 0;
|
| 290 |
+
padding: 0;
|
| 291 |
+
display: flex;
|
| 292 |
+
flex-direction: column;
|
| 293 |
+
justify-content: center;
|
| 294 |
+
align-items: center;
|
| 295 |
+
min-height: 100vh;
|
| 296 |
+
color: #333;
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
.custom-button {
|
| 300 |
+
background: linear-gradient(271.15deg, #00C7E2 0.27%, #00CC6A 48.52%, #70FF00 102.07%);
|
| 301 |
+
font-size: 30px;
|
| 302 |
+
color: white;
|
| 303 |
+
padding: 10px 20px;
|
| 304 |
+
border: none;
|
| 305 |
+
border-radius: 5px;
|
| 306 |
+
cursor: pointer;
|
| 307 |
+
transition: opacity 0.3s ease;
|
| 308 |
+
width: 100%;
|
| 309 |
+
max-width: 250px;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
.custom-button:hover {
|
| 313 |
+
opacity: 0.8;
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
.custom-title {
|
| 317 |
+
font-size: 36px;
|
| 318 |
+
background: linear-gradient(271.15deg, #00C7E2 0.27%, #12C06D 102.07%);
|
| 319 |
+
-webkit-background-clip: text;
|
| 320 |
+
-webkit-text-fill-color: transparent;
|
| 321 |
+
font-weight: bold;
|
| 322 |
text-align: center;
|
| 323 |
+
margin-bottom: 20px;
|
| 324 |
+
width: 100%;
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
.container, .example {
|
| 328 |
+
width: 100%;
|
| 329 |
+
padding: 0 1rem;
|
| 330 |
+
box-sizing: border-box;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
h1, h2 {
|
| 334 |
+
color: #222222;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
a {
|
| 338 |
+
color: #4a90e2;
|
| 339 |
+
text-decoration: none;
|
| 340 |
+
font-weight: bold;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
a:hover {
|
| 344 |
+
text-decoration: underline;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
.emoji {
|
| 348 |
+
font-size: 1.5em;
|
| 349 |
}
|
| 350 |
|
| 351 |
#share-btn-container {
|
|
|
|
| 355 |
justify-content: center;
|
| 356 |
align-items: center;
|
| 357 |
border-radius: 9999px !important;
|
| 358 |
+
max-width: 100%;
|
| 359 |
+
margin: 1rem auto;
|
| 360 |
}
|
| 361 |
|
| 362 |
#share-btn-container > div {
|
|
|
|
| 404 |
background: #1565c0;
|
| 405 |
}
|
| 406 |
|
| 407 |
+
/* Responsive Adjustments */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
@media (max-width: 768px) {
|
| 409 |
.custom-button {
|
| 410 |
font-size: 20px;
|
|
|
|
| 415 |
font-size: 28px;
|
| 416 |
}
|
| 417 |
|
| 418 |
+
h1, h2 {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
font-size: 24px;
|
| 420 |
}
|
| 421 |
}
|
|
|
|
| 430 |
font-size: 22px;
|
| 431 |
}
|
| 432 |
|
| 433 |
+
h1, h2 {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 434 |
font-size: 20px;
|
| 435 |
}
|
| 436 |
|
|
|
|
| 439 |
padding: 0.5rem;
|
| 440 |
}
|
| 441 |
}
|
| 442 |
+
"""
|
| 443 |
+
|
| 444 |
+
# Function to process image generation
|
| 445 |
+
def process_generate(fore, prompt, intensity, mode, refprompt, isrmbg):
|
| 446 |
+
# Your function logic here
|
| 447 |
+
return fore
|
| 448 |
+
|
| 449 |
+
# Define the layout using Gradio
|
| 450 |
block = gr.Blocks(css=css, title="## F.ai Fuzer").queue()
|
| 451 |
with block:
|
| 452 |
+
gr.HTML('<meta name="viewport" content="width=device-width, initial-scale=1.0">')
|
|
|
|
|
|
|
| 453 |
|
| 454 |
gr.HTML('''
|
| 455 |
<div class="container">
|
|
|
|
| 477 |
</ul>
|
| 478 |
</div>
|
| 479 |
''')
|
| 480 |
+
|
| 481 |
gr.HTML('<center><h2><a href="https://api-dashboard.fotographer.ai/login.html">🔗 Check out our API!</a></h2></center>')
|
| 482 |
|
| 483 |
with gr.Row():
|
| 484 |
gr.Markdown("### F.ai Fuzer: Real Composite Photography in 2 minutes!")
|
| 485 |
+
|
| 486 |
with gr.Row():
|
| 487 |
fore = gr.Image(image_mode='RGBA', type="pil", label="Foreground Image", height=400, width=400)
|
| 488 |
with gr.Column():
|
|
|
|
| 496 |
with gr.Row():
|
| 497 |
mode = gr.Radio(choices=[e.value for e in Stage], value=Stage.FULL.value, label="Generation Mode", type='value')
|
| 498 |
mode.change(fn=update_value, inputs=mode, outputs=mode)
|
| 499 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 500 |
with gr.Row():
|
| 501 |
intensity = gr.Slider(label="Refiner Strength", minimum=1.0, maximum=7.0, value=3.0, step=0.5)
|
| 502 |
intensity.change(fn=update_value, inputs=intensity, outputs=intensity)
|
|
|
|
| 515 |
</ul>
|
| 516 |
''')
|
| 517 |
|
| 518 |
+
gr.HTML('<center><h2><a href="https://fotographer.ai/">🔗 Check Out our other Projects Here!</a></h2></center>')
|
| 519 |
+
|
|
|
|
|
|
|
| 520 |
with gr.Row():
|
| 521 |
dummy_image_for_outputs = gr.Image(visible=False, label='Result', height=400, width=400)
|
| 522 |
gr.Examples(
|
|
|
|
| 525 |
inputs=[
|
| 526 |
fore, prompt, intensity, mode, refprompt, isrmbg, dummy_image_for_outputs
|
| 527 |
]
|
|
|
|
| 528 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 529 |
|
| 530 |
ins = [fore, prompt, intensity, mode, refprompt, isrmbg]
|
| 531 |
generate_button.click(fn=process_generate, inputs=ins, outputs=[result_gallery])
|
| 532 |
|
|
|
|
|
|
|
| 533 |
block.launch()
|
| 534 |
|