From 5905fcb97e341a6518dec31167634f076d095a14 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Thu, 11 May 2023 19:43:30 -0400 Subject: [PATCH] deduplicate themes --- javascript/black-orange.css | 2 +- modules/call_queue.py | 4 +++- modules/shared.py | 2 +- modules/ui_common.py | 3 --- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/javascript/black-orange.css b/javascript/black-orange.css index 365ba8a63..0028b781f 100644 --- a/javascript/black-orange.css +++ b/javascript/black-orange.css @@ -90,7 +90,7 @@ svg.feather.feather-image, .feather .feather-image { display: none } #txt2img_cfg_scale { min-width: 200px; } #txt2img_checkboxes, #img2img_checkboxes { background-color: transparent; } #txt2img_checkboxes, #img2img_checkboxes { margin-bottom: 0.2em; } -#txt2img_gallery, #img2img_gallery, #extras_gallery { background: black !important; padding: 0; margin: 0; object-fit: contain; box-shadow: none; min-height: 0; } +#txt2img_gallery, #img2img_gallery, #extras_gallery { background: black !important; padding: 0; margin: 0; object-fit: contain; box-shadow: none; min-height: 0; height: 45vh; } #txt2img_generate, #img2img_generate { height: 36px; border: none; border-radius: 0; min-height: 36px; padding: 0; } #txt2img_interrupt, #img2img_interrupt, #txt2img_skip, #img2img_skip { height: 36px; min-width: 116px; max-width: 116px; border: none; border-radius: 0; background-color: var(--inactive-color); margin-top: 46px; display: block !important; padding: 0; } #txt2img_progress_row > div { min-width: var(--left-column); max-width: var(--left-column); } diff --git a/modules/call_queue.py b/modules/call_queue.py index 3af8eca08..abd304ee6 100644 --- a/modules/call_queue.py +++ b/modules/call_queue.py @@ -4,7 +4,6 @@ import time import cProfile import pstats import io - from modules import shared, progress, errors queue_lock = threading.Lock() @@ -29,9 +28,12 @@ def wrap_gradio_gpu_call(func, extra_outputs=None): with queue_lock: shared.state.begin() progress.start_task(id_task) + res = None try: res = func(*args, **kwargs) progress.record_results(id_task, res) + except Exception as e: + shared.log.error(f"Exception: {e}") finally: progress.finish_task(id_task) shared.state.end() diff --git a/modules/shared.py b/modules/shared.py index 6e3f423ea..4597204b8 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -206,7 +206,7 @@ def list_themes(): else: res = [] builtin = ["black-orange", "gradio/default", "gradio/base", "gradio/glass", "gradio/monochrome", "gradio/soft"] - themes = builtin + [x['id'] for x in res if x['status'] == 'RUNNING' and 'test' not in x['id'].lower()] + themes = sorted(set(builtin + [x['id'] for x in res if x['status'] == 'RUNNING' and 'test' not in x['id'].lower()])) return themes diff --git a/modules/ui_common.py b/modules/ui_common.py index 7ac745b8d..c14f9be75 100644 --- a/modules/ui_common.py +++ b/modules/ui_common.py @@ -62,7 +62,6 @@ def save_files(js_data, images, do_make_zip, index): writer = csv.writer(file) if at_start: writer.writerow(["prompt", "seed", "width", "height", "sampler", "cfgs", "steps", "filename", "negative_prompt"]) - for image_index, filedata in enumerate(images, start_index): image = image_from_url_text(filedata) is_grid = image_index < p.index_of_first_image # pylint: disable=no-member @@ -85,14 +84,12 @@ def save_files(js_data, images, do_make_zip, index): # Make Zip if do_make_zip: zip_filepath = os.path.join(path, "images.zip") - from zipfile import ZipFile with ZipFile(zip_filepath, "w") as zip_file: for i in range(len(fullfns)): with open(fullfns[i], mode="rb") as f: zip_file.writestr(filenames[i], f.read()) fullfns.insert(0, zip_filepath) - return gr.File.update(value=fullfns, visible=True), plaintext_to_html(f"Saved: {filenames[0]}")