RishubhPar commited on
Commit
6b47d9c
·
verified ·
1 Parent(s): af1e1d3

changes small

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -329,7 +329,11 @@ def generate_image_stack_edits(text_prompt, n_edits, input_image):
329
  return (list_of_images, first_image) so the UI shows immediately.
330
  """
331
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
 
 
332
  global PIPELINE
 
 
333
 
334
  if not input_image or not text_prompt or text_prompt.startswith("Please select"):
335
  return [], None
@@ -520,7 +524,14 @@ def process_user_upload(uploaded_image, user_prompt, n_edits_val):
520
 
521
  return processed_image, generated_list, first_result, slider_update
522
 
 
 
 
 
 
523
  with gr.Blocks() as demo:
 
 
524
  gr.Markdown("# Kontinuous Kontext - Continuous Strength Control for Instruction-based Image Editing")
525
 
526
  # Add description section
 
329
  return (list_of_images, first_image) so the UI shows immediately.
330
  """
331
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
332
+
333
+ # if pipeline is null will initialize it simply.
334
  global PIPELINE
335
+ if PIPELINE is None:
336
+ status = load_pipeline_single_gpu()
337
 
338
  if not input_image or not text_prompt or text_prompt.startswith("Please select"):
339
  return [], None
 
524
 
525
  return processed_image, generated_list, first_result, slider_update
526
 
527
+
528
+ @spaces.GPU
529
+ def gpu_warmup():
530
+ return load_pipeline_single_gpu()
531
+
532
  with gr.Blocks() as demo:
533
+ # warming up the demo for the first run
534
+ demo.load(gpu_warmup)
535
  gr.Markdown("# Kontinuous Kontext - Continuous Strength Control for Instruction-based Image Editing")
536
 
537
  # Add description section