HAL1993 commited on
Commit
1a5ced7
·
verified ·
1 Parent(s): 80a0d12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -21
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 and download button scaling
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
- with gr.Column():
401
- input_fg = gr.Image(sources='upload', type="numpy", label="Imazhi i Ngarkuar", height=480)
402
- prompt = gr.Textbox(label="Përshkrimi", placeholder="Shkruani përshkrimin këtu")
403
- bg_source = gr.Radio(choices=[e.value for e in BGSource], value=BGSource.NONE.value, label="Preferenca e Ndriçimit", type='value')
404
- aspect_ratio = gr.Radio(choices=["9:16", "1:1", "16:9"], value="1:1", label="Raporti i Aspektit")
405
- relight_button = gr.Button(value="Rindriço")
406
- result_gallery = gr.Gallery(label="Rezultatet", height=832, object_fit='contain')
407
- # Hidden components for other parameters and output_bg
408
- image_width = gr.Slider(label="Gjerësia e Imazhit", minimum=256, maximum=1024, value=640, step=64, visible=False)
409
- image_height = gr.Slider(label="Lartësia e Imazhit", minimum=256, maximum=1024, value=640, step=64, visible=False)
410
- num_samples = gr.Slider(label="Numri i Imazheve", minimum=1, maximum=12, value=1, step=1, visible=False)
411
- seed = gr.Number(label="Fara", value=12345, precision=0, visible=False)
412
- steps = gr.Slider(label="Hapat", minimum=1, maximum=100, value=50, step=1, visible=False)
413
- a_prompt = gr.Textbox(label="Përshkrim i Shtuar", value='best quality', visible=False)
414
- n_prompt = gr.Textbox(label="Përshkrim Negativ", value='lowres, bad anatomy, bad hands, cropped, worst quality', visible=False)
415
- cfg = gr.Slider(label="Shkalla CFG", minimum=1.0, maximum=32.0, value=2, step=0.01, visible=False)
416
- highres_scale = gr.Slider(label="Shkalla e Rezolutës së Lartë", minimum=1.0, maximum=3.0, value=2, step=0.01, visible=False)
417
- 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)
418
- 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)
419
- output_bg = gr.Image(type="numpy", label="Parapërpunimi i Planit të Parë", visible=False)
 
 
 
 
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(