Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,10 +11,42 @@ import runpod
|
|
| 11 |
from enum import Enum
|
| 12 |
|
| 13 |
|
|
|
|
| 14 |
api_key = os.getenv("FAI_API_KEY")
|
| 15 |
api = os.getenv("FAI_API")
|
| 16 |
rmbgkey = os.getenv("RMBGKEY")
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
def rmbg(pil_image):
|
| 19 |
|
| 20 |
# Convert PIL image to bytes
|
|
@@ -315,9 +347,9 @@ with block:
|
|
| 315 |
with gr.Column():
|
| 316 |
gr.HTML('''
|
| 317 |
<div class="container">
|
| 318 |
-
<h1>π For more freedom of usage,
|
| 319 |
-
<p>π€
|
| 320 |
-
<
|
| 321 |
</div>
|
| 322 |
''')
|
| 323 |
|
|
@@ -330,9 +362,23 @@ with block:
|
|
| 330 |
|
| 331 |
gr.HTML("""
|
| 332 |
<center><h2><a href="https://test-apidash-dot-lightr-fotographer-app-dot-fotographer-ai.an.r.appspot.com/login.html">π Check Out our other Projects Here!:</a></h2></center>""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
|
| 334 |
-
|
| 335 |
-
generate_button.click(fn=process_generate, inputs=
|
|
|
|
| 336 |
|
| 337 |
|
| 338 |
block.launch()
|
|
|
|
| 11 |
from enum import Enum
|
| 12 |
|
| 13 |
|
| 14 |
+
|
| 15 |
api_key = os.getenv("FAI_API_KEY")
|
| 16 |
api = os.getenv("FAI_API")
|
| 17 |
rmbgkey = os.getenv("RMBGKEY")
|
| 18 |
|
| 19 |
+
#fore, prompt, intensity, mode, refprompt, isrmbg
|
| 20 |
+
examples = [
|
| 21 |
+
[
|
| 22 |
+
"examples/in1.png",
|
| 23 |
+
"beautiful woman, cinematic lighting",
|
| 24 |
+
3.0,
|
| 25 |
+
"full",
|
| 26 |
+
"vibrant, light",
|
| 27 |
+
False,
|
| 28 |
+
"examples/out1.png",
|
| 29 |
+
],
|
| 30 |
+
[
|
| 31 |
+
"examples/in2.png",
|
| 32 |
+
"beautiful woman, cinematic lighting",
|
| 33 |
+
2.0,
|
| 34 |
+
"full",
|
| 35 |
+
"vibrant, light",
|
| 36 |
+
False,
|
| 37 |
+
"examples/out3.png",
|
| 38 |
+
],
|
| 39 |
+
[
|
| 40 |
+
"examples/in3.png",
|
| 41 |
+
"beautiful woman, cinematic lighting",
|
| 42 |
+
2.0,
|
| 43 |
+
"full",
|
| 44 |
+
"vibrant, light",
|
| 45 |
+
False,
|
| 46 |
+
"examples/out3.png",
|
| 47 |
+
],
|
| 48 |
+
]
|
| 49 |
+
|
| 50 |
def rmbg(pil_image):
|
| 51 |
|
| 52 |
# Convert PIL image to bytes
|
|
|
|
| 347 |
with gr.Column():
|
| 348 |
gr.HTML('''
|
| 349 |
<div class="container">
|
| 350 |
+
<h1>π For more freedom of usage, check out our API</h1>
|
| 351 |
+
<p>π€ You can test with free credits:</p>
|
| 352 |
+
<h2><a href="https://test-apidash-dot-lightr-fotographer-app-dot-fotographer-ai.an.r.appspot.com/login.html">π API Dashboard</a></h2>
|
| 353 |
</div>
|
| 354 |
''')
|
| 355 |
|
|
|
|
| 362 |
|
| 363 |
gr.HTML("""
|
| 364 |
<center><h2><a href="https://test-apidash-dot-lightr-fotographer-app-dot-fotographer-ai.an.r.appspot.com/login.html">π Check Out our other Projects Here!:</a></h2></center>""")
|
| 365 |
+
|
| 366 |
+
with gr.Row():
|
| 367 |
+
imgholder = gr.Image(visible=False, label='Result')
|
| 368 |
+
gr.Examples(
|
| 369 |
+
fn=lambda *args: [args[-1]],
|
| 370 |
+
examples=examples,
|
| 371 |
+
inputs=[
|
| 372 |
+
fore, prompt, intensity, mode, refprompt, isrmbg, imgholder
|
| 373 |
+
],
|
| 374 |
+
outputs=[result_gallery],
|
| 375 |
+
run_on_click=True, examples_per_page=1024
|
| 376 |
+
)
|
| 377 |
+
|
| 378 |
|
| 379 |
+
ins = [fore, prompt, intensity, mode, refprompt, isrmbg]
|
| 380 |
+
generate_button.click(fn=process_generate, inputs=ins, outputs=[result_gallery])
|
| 381 |
+
|
| 382 |
|
| 383 |
|
| 384 |
block.launch()
|