Sebastiankay commited on
Commit
db84959
1 Parent(s): 5da4472

Sep 10, 2024, 3:54 PM

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -129,7 +129,7 @@ def image_get_dominant_color(image_path):
129
 
130
 
131
  # MARK: PROCESS IMAGE
132
- def process(Prompt, image_width, image_height, image_seed, randomize_seed):
133
  random_prompt_value = None
134
  if Prompt == "":
135
  gr.Info("Kein Prompt angegeben, es wird ein zufälliger Prompt generiert.", duration=15)
@@ -138,6 +138,8 @@ def process(Prompt, image_width, image_height, image_seed, randomize_seed):
138
 
139
  used_seed = random.randint(0, MAX_SEED) if image_seed == 0 or randomize_seed else image_seed
140
  used_model = "turbo" if int(image_width) > 1024 or int(image_height) > 1024 else "flux" # turbo, flux
 
 
141
 
142
  timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
143
  filename_prompt = re.sub(r"[^\w\s-]", "", Prompt).strip().replace(" ", "_")
@@ -250,7 +252,7 @@ with gr.Blocks(theme=theme, head=custom_head, css=custom_css, js=custom_js, titl
250
 
251
  image_ratio_buttons.input(fn=calculate_ratio_values, inputs=[image_ratio_buttons, image_width, image_height], outputs=[image_width, image_height], show_progress="hidden")
252
 
253
- run_button.click(fn=process, inputs=[text_prompt, image_width, image_height, image_seed, randomize_seed], outputs=[output_image, output_url, outpu_image_comment, image_informations, image_info_tb_prompt, image_info_tb_width, image_info_tb_height, image_info_tb_seed, image_download_button, output_dominant_image_color, image_seed, random_promp_output])
254
 
255
  enhance_prompt_button.click(fn=groq_enhance_process, inputs=[text_prompt], outputs=[text_prompt])
256
  random_prompt_button.click(fn=groq_enhance_process, inputs=None, outputs=[text_prompt])
 
129
 
130
 
131
  # MARK: PROCESS IMAGE
132
+ def process(Prompt, image_width, image_height, image_seed, randomize_seed, previous_prompt):
133
  random_prompt_value = None
134
  if Prompt == "":
135
  gr.Info("Kein Prompt angegeben, es wird ein zufälliger Prompt generiert.", duration=15)
 
138
 
139
  used_seed = random.randint(0, MAX_SEED) if image_seed == 0 or randomize_seed else image_seed
140
  used_model = "turbo" if int(image_width) > 1024 or int(image_height) > 1024 else "flux" # turbo, flux
141
+
142
+ previous_prompt = Prompt if previous_prompt == Prompt else previous_prompt
143
 
144
  timestamp = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
145
  filename_prompt = re.sub(r"[^\w\s-]", "", Prompt).strip().replace(" ", "_")
 
252
 
253
  image_ratio_buttons.input(fn=calculate_ratio_values, inputs=[image_ratio_buttons, image_width, image_height], outputs=[image_width, image_height], show_progress="hidden")
254
 
255
+ run_button.click(fn=process, inputs=[text_prompt, image_width, image_height, image_seed, randomize_seed, image_info_tb_prompt], outputs=[output_image, output_url, outpu_image_comment, image_informations, image_info_tb_prompt, image_info_tb_width, image_info_tb_height, image_info_tb_seed, image_download_button, output_dominant_image_color, image_seed, random_promp_output])
256
 
257
  enhance_prompt_button.click(fn=groq_enhance_process, inputs=[text_prompt], outputs=[text_prompt])
258
  random_prompt_button.click(fn=groq_enhance_process, inputs=None, outputs=[text_prompt])