alex-remade commited on
Commit
719dba0
·
1 Parent(s): d948455

working with progress

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -285,7 +285,7 @@ async def handle_generation(input_image, subject, duration, selected_index, prog
285
  # Update progress
286
  if 'progress' in generation:
287
  progress_value = generation['progress']
288
- progress_bar = f'<div class="progress-container"><div class="progress-bar" style="--current: {progress_value}; --total: 100;"></div></div>'
289
 
290
  # Check status
291
  if generation['status'] == 'completed':
@@ -311,15 +311,18 @@ css = '''
311
  #title{text-align: center}
312
  #title h1{font-size: 3em; display:inline-flex; align-items:center}
313
  #title img{width: 100px; margin-right: 0.5em}
314
- #gallery .grid-wrap{height: 10vh}
 
315
  #lora_list{background: var(--block-background-fill);padding: 0 1em .3em; font-size: 90%}
316
  .card_internal{display: flex;height: 100px;margin-top: .5em}
317
  .card_internal img{margin-right: 1em}
318
  .styler{--form-gap-width: 0px !important}
319
  #progress{height:30px}
320
  #progress .generating{display:none}
321
- .progress-container {width: 100%;height: 30px;background-color: #f0f0f0;border-radius: 15px;overflow: hidden;margin-bottom: 20px}
322
- .progress-bar {height: 100%;background-color: #4f46e5;width: calc(var(--current) / var(--total) * 100%);transition: width 0.5s ease-in-out}
 
 
323
  '''
324
 
325
  with gr.Blocks(css=css) as demo:
@@ -330,7 +333,7 @@ with gr.Blocks(css=css) as demo:
330
  selected_info = gr.HTML("")
331
 
332
  with gr.Row():
333
- with gr.Column():
334
  gallery = gr.Gallery(
335
  [(item["image"], item["title"]) for item in loras],
336
  label="Select LoRA",
@@ -338,14 +341,15 @@ with gr.Blocks(css=css) as demo:
338
  columns=4,
339
  elem_id="gallery",
340
  show_share_button=False,
341
- height=350
 
342
  )
343
  input_image = gr.Image(type="filepath")
344
  subject = gr.Textbox(label="Describe your subject", placeholder="Cat toy")
345
  duration = gr.Radio(["Short (3s)", "Long (5s)"], label="Duration", value="Short (3s)")
346
  button = gr.Button("Generate", variant="primary", elem_id="gen_btn")
347
 
348
- with gr.Column():
349
  progress_bar = gr.Markdown(elem_id="progress", visible=False)
350
  output = gr.Video(interactive=False, label="Output video")
351
 
 
285
  # Update progress
286
  if 'progress' in generation:
287
  progress_value = generation['progress']
288
+ progress_bar = f'<div class="progress-container"><div class="progress-bar" style="--current: {progress_value}; --total: 100;"><span class="progress-text">Processing: {progress_value}%</span></div></div><div class="refresh-warning">Please do not refresh this page while processing</div>'
289
 
290
  # Check status
291
  if generation['status'] == 'completed':
 
311
  #title{text-align: center}
312
  #title h1{font-size: 3em; display:inline-flex; align-items:center}
313
  #title img{width: 100px; margin-right: 0.5em}
314
+ #gallery .grid-wrap{height: auto; min-height: 350px}
315
+ #gallery .gallery-item {height: 100%; width: 100%; object-fit: cover}
316
  #lora_list{background: var(--block-background-fill);padding: 0 1em .3em; font-size: 90%}
317
  .card_internal{display: flex;height: 100px;margin-top: .5em}
318
  .card_internal img{margin-right: 1em}
319
  .styler{--form-gap-width: 0px !important}
320
  #progress{height:30px}
321
  #progress .generating{display:none}
322
+ .progress-container {width: 100%;height: 30px;background-color: #f0f0f0;border-radius: 15px;overflow: hidden;margin-bottom: 20px;position: relative;}
323
+ .progress-bar {height: 100%;background-color: #90EE90;width: calc(var(--current) / var(--total) * 100%);transition: width 0.5s ease-in-out}
324
+ .progress-text {position: absolute;width: 100%;text-align: center;top: 50%;left: 0;transform: translateY(-50%);color: #000;font-weight: bold;}
325
+ .refresh-warning {color: #e74c3c;font-weight: bold;text-align: center;margin-top: 5px;}
326
  '''
327
 
328
  with gr.Blocks(css=css) as demo:
 
333
  selected_info = gr.HTML("")
334
 
335
  with gr.Row():
336
+ with gr.Column(scale=1):
337
  gallery = gr.Gallery(
338
  [(item["image"], item["title"]) for item in loras],
339
  label="Select LoRA",
 
341
  columns=4,
342
  elem_id="gallery",
343
  show_share_button=False,
344
+ height="350px",
345
+ object_fit="contain"
346
  )
347
  input_image = gr.Image(type="filepath")
348
  subject = gr.Textbox(label="Describe your subject", placeholder="Cat toy")
349
  duration = gr.Radio(["Short (3s)", "Long (5s)"], label="Duration", value="Short (3s)")
350
  button = gr.Button("Generate", variant="primary", elem_id="gen_btn")
351
 
352
+ with gr.Column(scale=1):
353
  progress_bar = gr.Markdown(elem_id="progress", visible=False)
354
  output = gr.Video(interactive=False, label="Output video")
355