feat: add method get_scheme to Metadata

This commit is contained in:
Manuel Schmid 2024-02-02 01:19:21 +01:00
parent ea6839be83
commit f4afc4af10
No known key found for this signature in database
GPG Key ID: 32C4F7569B40B84B
1 changed files with 9 additions and 0 deletions

View File

@ -23,7 +23,12 @@ def get_sha256(filepath):
return hash_cache[filepath]
class MetadataParser(ABC):
@abstractmethod
def get_scheme(self) -> MetadataScheme:
raise NotImplementedError
@abstractmethod
def parse_json(self, metadata: dict) -> dict:
raise NotImplementedError
@ -34,6 +39,8 @@ class MetadataParser(ABC):
class A1111MetadataParser(MetadataParser):
def get_scheme(self) -> MetadataScheme:
return MetadataScheme.A1111
fooocus_to_a1111 = {
'negative_prompt': 'Negative prompt',
@ -184,6 +191,8 @@ class A1111MetadataParser(MetadataParser):
class FooocusMetadataParser(MetadataParser):
def get_scheme(self) -> MetadataScheme:
return MetadataScheme.FOOOCUS
def parse_json(self, metadata: dict) -> dict:
model_filenames = modules.config.model_filenames.copy()