Pijush2023 commited on
Commit
d650995
·
verified ·
1 Parent(s): 9dce5d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -1173,6 +1173,7 @@ def handle_model_choice_change(selected_model):
1173
  # image_3 = generate_image_flux(hardcoded_prompt_3)
1174
  # return image_1, image_2, image_3
1175
 
 
1176
  hardcoded_prompt_1 = "A high quality cinematic image for Toyota Truck in Birmingham skyline shot in the style of Michael Mann"
1177
  hardcoded_prompt_2 = "A high quality cinematic image for Alabama Quarterback close up emotional shot in the style of Michael Mann"
1178
  hardcoded_prompt_3 = "A high quality cinematic image for Taylor Swift concert in Birmingham skyline style of Michael Mann"
@@ -1199,7 +1200,6 @@ def generate_image_flux(prompt):
1199
 
1200
  return image_path_or_url # Return the image path or URL directly
1201
 
1202
-
1203
  # Function to update images with the three prompts
1204
  def update_images():
1205
  image_1 = generate_image_flux(hardcoded_prompt_1)
@@ -1211,7 +1211,6 @@ def update_images():
1211
 
1212
 
1213
 
1214
-
1215
  def format_restaurant_hotel_info(name, link, location, phone, rating, reviews, snippet):
1216
  return f"""
1217
  {name}
@@ -1517,13 +1516,18 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
1517
 
1518
  # Displaying the images generated using Flux API
1519
  image_output_1 = gr.Image(label="Image 1", elem_id="flux_image_1", width=400, height=400)
1520
- # image_output_2 = gr.Image(label="Image 2", elem_id="flux_image_2", width=400, height=400)
1521
- # image_output_3 = gr.Image(label="Image 3", elem_id="flux_image_3", width=400, height=400)
1522
-
 
 
 
 
 
 
1523
  # Refresh button to update images
1524
  refresh_button = gr.Button("Refresh Images")
1525
- # refresh_button.click(fn=update_images, inputs=None, outputs=[image_output_1, image_output_2, image_output_3])
1526
- refresh_button.click(fn=update_images, inputs=None, outputs=[image_output_1])
1527
 
1528
 
1529
 
 
1173
  # image_3 = generate_image_flux(hardcoded_prompt_3)
1174
  # return image_1, image_2, image_3
1175
 
1176
+ # Existing prompts for the Flux API
1177
  hardcoded_prompt_1 = "A high quality cinematic image for Toyota Truck in Birmingham skyline shot in the style of Michael Mann"
1178
  hardcoded_prompt_2 = "A high quality cinematic image for Alabama Quarterback close up emotional shot in the style of Michael Mann"
1179
  hardcoded_prompt_3 = "A high quality cinematic image for Taylor Swift concert in Birmingham skyline style of Michael Mann"
 
1200
 
1201
  return image_path_or_url # Return the image path or URL directly
1202
 
 
1203
  # Function to update images with the three prompts
1204
  def update_images():
1205
  image_1 = generate_image_flux(hardcoded_prompt_1)
 
1211
 
1212
 
1213
 
 
1214
  def format_restaurant_hotel_info(name, link, location, phone, rating, reviews, snippet):
1215
  return f"""
1216
  {name}
 
1516
 
1517
  # Displaying the images generated using Flux API
1518
  image_output_1 = gr.Image(label="Image 1", elem_id="flux_image_1", width=400, height=400)
1519
+ image_output_2 = gr.Image(label="Image 2", elem_id="flux_image_2", width=400, height=400)
1520
+ image_output_3 = gr.Image(label="Image 3", elem_id="flux_image_3", width=400, height=400)
1521
+
1522
+ # Call update_images during the initial load to display images when the interface appears
1523
+ initial_images = update_images()
1524
+ image_output_1.update(value=initial_images[0])
1525
+ image_output_2.update(value=initial_images[1])
1526
+ image_output_3.update(value=initial_images[2])
1527
+
1528
  # Refresh button to update images
1529
  refresh_button = gr.Button("Refresh Images")
1530
+ refresh_button.click(fn=update_images, inputs=None, outputs=[image_output_1, image_output_2, image_output_3])
 
1531
 
1532
 
1533