File size: 621 Bytes
6709fc9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from .interfacegan import InterFaceGAN
from .ganspace import GanSpace
from .styleclip import StyleClip
from options import Settings

"""
Entry class for all the edits. 
"""
class Editor():
    def __init__(self) -> None:
        self.interfacegan_editor = InterFaceGAN()
        self.ganspace_editor = GanSpace()
        self.styleclip_editor = StyleClip()

    def edit(self, latent, cfg):
        # Finds the corresponding function using method name
        if cfg.method == 'inversion':
            return latent

        editor = getattr(self, f'{cfg.method}_editor')
        return editor.edit(latent, cfg)