condition clear flag
Browse files
app.py
CHANGED
@@ -51,14 +51,17 @@ def clear_session():
|
|
51 |
|
52 |
|
53 |
def assign_gpu(options, img_init, text_init, prompt_template_init, style_name_init, seeds_init, val_r_values_init, faster_init, model_name_init, input_type):
|
54 |
-
|
|
|
|
|
|
|
|
|
55 |
if options == 'GPU':
|
56 |
decorated_run = spaces.GPU(run_gpu)
|
57 |
return decorated_run(options, img_init, text_init, prompt_template_init, style_name_init, seeds_init, val_r_values_init, faster_init, model_name_init, input_type)
|
58 |
else:
|
59 |
return run_cpu(options, img_init, text_init, prompt_template_init, style_name_init, seeds_init, val_r_values_init, faster_init, model_name_init, input_type)
|
60 |
-
|
61 |
-
return gr.update(value=None), gr.update(value=None)
|
62 |
def read_temp_file(temp_file_wrapper):
|
63 |
name = temp_file_wrapper.name
|
64 |
with open(temp_file_wrapper.name, 'rb') as f:
|
|
|
51 |
|
52 |
|
53 |
def assign_gpu(options, img_init, text_init, prompt_template_init, style_name_init, seeds_init, val_r_values_init, faster_init, model_name_init, input_type):
|
54 |
+
global clear_flag
|
55 |
+
if clear_flag:
|
56 |
+
clear_flag = False # Reset the flag after handling the clear action
|
57 |
+
return gr.update(value=None), gr.update(value=None)
|
58 |
+
else:
|
59 |
if options == 'GPU':
|
60 |
decorated_run = spaces.GPU(run_gpu)
|
61 |
return decorated_run(options, img_init, text_init, prompt_template_init, style_name_init, seeds_init, val_r_values_init, faster_init, model_name_init, input_type)
|
62 |
else:
|
63 |
return run_cpu(options, img_init, text_init, prompt_template_init, style_name_init, seeds_init, val_r_values_init, faster_init, model_name_init, input_type)
|
64 |
+
|
|
|
65 |
def read_temp_file(temp_file_wrapper):
|
66 |
name = temp_file_wrapper.name
|
67 |
with open(temp_file_wrapper.name, 'rb') as f:
|