Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -370,7 +370,7 @@ def update_aspect_ratio(ratio):
|
|
| 370 |
# UI Layout
|
| 371 |
def create_demo():
|
| 372 |
with gr.Blocks() as block:
|
| 373 |
-
# CSS for 320px gap
|
| 374 |
gr.HTML("""
|
| 375 |
<style>
|
| 376 |
body::before {
|
|
@@ -394,29 +394,37 @@ def create_demo():
|
|
| 394 |
margin: 0 !important;
|
| 395 |
padding: 6px !important;
|
| 396 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
</style>
|
| 398 |
""")
|
| 399 |
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
# Update hidden sliders based on aspect ratio
|
| 422 |
aspect_ratio.change(
|
|
|
|
| 370 |
# UI Layout
|
| 371 |
def create_demo():
|
| 372 |
with gr.Blocks() as block:
|
| 373 |
+
# CSS for 320px gap, download button scaling, and container width constraint
|
| 374 |
gr.HTML("""
|
| 375 |
<style>
|
| 376 |
body::before {
|
|
|
|
| 394 |
margin: 0 !important;
|
| 395 |
padding: 6px !important;
|
| 396 |
}
|
| 397 |
+
.constrained-container {
|
| 398 |
+
max-width: 600px; /* Limits container width */
|
| 399 |
+
margin: 0 auto; /* Centers the container */
|
| 400 |
+
}
|
| 401 |
</style>
|
| 402 |
""")
|
| 403 |
|
| 404 |
+
gr.Markdown("# Rindriço Imazhin")
|
| 405 |
+
gr.Markdown("Rindriço imazhin duke ndryshuar sfondin bazuar në përshkrimin e dhënë")
|
| 406 |
+
|
| 407 |
+
with gr.Row():
|
| 408 |
+
with gr.Column(elem_classes="constrained-container"):
|
| 409 |
+
input_fg = gr.Image(sources='upload', type="numpy", label="Imazhi i Ngarkuar", height=480, width=480)
|
| 410 |
+
prompt = gr.Textbox(label="Përshkrimi", placeholder="Shkruani përshkrimin këtu")
|
| 411 |
+
bg_source = gr.Radio(choices=[e.value for e in BGSource], value=BGSource.NONE.value, label="Preferenca e Ndriçimit", type='value')
|
| 412 |
+
aspect_ratio = gr.Radio(choices=["9:16", "1:1", "16:9"], value="1:1", label="Raporti i Aspektit")
|
| 413 |
+
relight_button = gr.Button(value="Rindriço")
|
| 414 |
+
result_gallery = gr.Gallery(label="Rezultatet", height=832, object_fit='contain', elem_classes="constrained-container")
|
| 415 |
+
# Hidden components for other parameters and output_bg
|
| 416 |
+
image_width = gr.Slider(label="Gjerësia e Imazhit", minimum=256, maximum=1024, value=640, step=64, visible=False)
|
| 417 |
+
image_height = gr.Slider(label="Lartësia e Imazhit", minimum=256, maximum=1024, value=640, step=64, visible=False)
|
| 418 |
+
num_samples = gr.Slider(label="Numri i Imazheve", minimum=1, maximum=12, value=1, step=1, visible=False)
|
| 419 |
+
seed = gr.Number(label="Fara", value=12345, precision=0, visible=False)
|
| 420 |
+
steps = gr.Slider(label="Hapat", minimum=1, maximum=100, value=50, step=1, visible=False)
|
| 421 |
+
a_prompt = gr.Textbox(label="Përshkrim i Shtuar", value='best quality', visible=False)
|
| 422 |
+
n_prompt = gr.Textbox(label="Përshkrim Negativ", value='lowres, bad anatomy, bad hands, cropped, worst quality', visible=False)
|
| 423 |
+
cfg = gr.Slider(label="Shkalla CFG", minimum=1.0, maximum=32.0, value=2, step=0.01, visible=False)
|
| 424 |
+
highres_scale = gr.Slider(label="Shkalla e Rezolutës së Lartë", minimum=1.0, maximum=3.0, value=2, step=0.01, visible=False)
|
| 425 |
+
highres_denoise = gr.Slider(label="Denoise i Rezolutës së Lartë", minimum=0.1, maximum=1.0, value=0.5, step=0.01, visible=False)
|
| 426 |
+
lowres_denoise = gr.Slider(label="Denoise i Rezolutës së Ulët", minimum=0.1, maximum=1.0, value=0.9, step=0.01, visible=False)
|
| 427 |
+
output_bg = gr.Image(type="numpy", label="Parapërpunimi i Planit të Parë", visible=False)
|
| 428 |
|
| 429 |
# Update hidden sliders based on aspect ratio
|
| 430 |
aspect_ratio.change(
|