mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
feat: code cleanup, do not queue metadata preview on image upload
This commit is contained in:
+2
-3
@@ -118,11 +118,9 @@ class A1111MetadataParser(MetadataParser):
|
|||||||
def parse_string(self, metadata: dict) -> str:
|
def parse_string(self, metadata: dict) -> str:
|
||||||
data = {k: v for _, k, v, _, _ in metadata}
|
data = {k: v for _, k, v, _, _ in metadata}
|
||||||
|
|
||||||
# TODO check if correct
|
|
||||||
width, heigth = eval(data['resolution'])
|
width, heigth = eval(data['resolution'])
|
||||||
|
|
||||||
lora_hashes = []
|
lora_hashes = []
|
||||||
lora_weights = []
|
|
||||||
for index in range(lora_count_with_lcm):
|
for index in range(lora_count_with_lcm):
|
||||||
key = f'lora_name_{index + 1}'
|
key = f'lora_name_{index + 1}'
|
||||||
if key in data:
|
if key in data:
|
||||||
@@ -275,7 +273,8 @@ class FooocusMetadataParser(MetadataParser):
|
|||||||
# # return json.dumps(metadata, ensure_ascii=True) TODO check if possible
|
# # return json.dumps(metadata, ensure_ascii=True) TODO check if possible
|
||||||
# return json.dumps(metadata, ensure_ascii=False)
|
# return json.dumps(metadata, ensure_ascii=False)
|
||||||
|
|
||||||
def replace_value_with_filename(self, key, value, filenames):
|
@staticmethod
|
||||||
|
def replace_value_with_filename(key, value, filenames):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
path = Path(filename)
|
path = Path(filename)
|
||||||
if key.startswith('lora_combined_'):
|
if key.startswith('lora_combined_'):
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ with shared.gradio_root:
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
metadata_input_image.upload(trigger_metadata_preview, inputs=metadata_input_image,
|
metadata_input_image.upload(trigger_metadata_preview, inputs=metadata_input_image,
|
||||||
outputs=metadata_json)
|
outputs=metadata_json, queue=False, show_progress=True)
|
||||||
|
|
||||||
switch_js = "(x) => {if(x){viewer_to_bottom(100);viewer_to_bottom(500);}else{viewer_to_top();} return x;}"
|
switch_js = "(x) => {if(x){viewer_to_bottom(100);viewer_to_bottom(500);}else{viewer_to_top();} return x;}"
|
||||||
down_js = "() => {viewer_to_bottom();}"
|
down_js = "() => {viewer_to_bottom();}"
|
||||||
|
|||||||
Reference in New Issue
Block a user