Pijush2023 commited on
Commit
44fe0b5
·
verified ·
1 Parent(s): 141ad3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -12
app.py CHANGED
@@ -1130,7 +1130,6 @@ import torch
1130
  from diffusers import FluxPipeline
1131
  from PIL import Image
1132
 
1133
- # Flux Image Generation
1134
  # Load the Flux pipeline
1135
  flux_pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
1136
  flux_pipe.enable_model_cpu_offload() # Save some VRAM by offloading to CPU if needed
@@ -1157,12 +1156,10 @@ hardcoded_prompt_1 = "A high quality cinematic image for Toyota Truck in Birming
1157
  hardcoded_prompt_2 = "A high quality cinematic image for Alabama Quarterback close up emotional shot in the style of Michael Mann"
1158
  hardcoded_prompt_3 = "A high quality cinematic image for Taylor Swift concert in Birmingham skyline style of Michael Mann"
1159
 
1160
- # Generate the images automatically upon launching the interface
1161
- def show_images_on_startup():
1162
- img1 = generate_flux_image(hardcoded_prompt_1)
1163
- img2 = generate_flux_image(hardcoded_prompt_2)
1164
- img3 = generate_flux_image(hardcoded_prompt_3)
1165
- return img1, img2, img3
1166
 
1167
 
1168
 
@@ -1464,11 +1461,10 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
1464
  events_output = gr.HTML(value=fetch_local_events())
1465
 
1466
  with gr.Column():
1467
- gr.Markdown("<h1 style='color: blue;'>Cinematic Images Generated with Flux</h1>")
1468
- image_output_1 = gr.Image()
1469
- image_output_2 = gr.Image()
1470
- image_output_3 = gr.Image()
1471
- demo.load(fn=show_images_on_startup, outputs=[image_output_1, image_output_2, image_output_3])
1472
 
1473
 
1474
 
 
1130
  from diffusers import FluxPipeline
1131
  from PIL import Image
1132
 
 
1133
  # Load the Flux pipeline
1134
  flux_pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
1135
  flux_pipe.enable_model_cpu_offload() # Save some VRAM by offloading to CPU if needed
 
1156
  hardcoded_prompt_2 = "A high quality cinematic image for Alabama Quarterback close up emotional shot in the style of Michael Mann"
1157
  hardcoded_prompt_3 = "A high quality cinematic image for Taylor Swift concert in Birmingham skyline style of Michael Mann"
1158
 
1159
+ # Generate the images immediately
1160
+ img1_path = generate_flux_image(hardcoded_prompt_1)
1161
+ img2_path = generate_flux_image(hardcoded_prompt_2)
1162
+ img3_path = generate_flux_image(hardcoded_prompt_3)
 
 
1163
 
1164
 
1165
 
 
1461
  events_output = gr.HTML(value=fetch_local_events())
1462
 
1463
  with gr.Column():
1464
+ # Display the pre-generated images directly
1465
+ image_output_1 = gr.Image(value=img1_path)
1466
+ image_output_2 = gr.Image(value=img2_path)
1467
+ image_output_3 = gr.Image(value=img3_path)
 
1468
 
1469
 
1470