Spaces:
Runtime error
Runtime error
Download editings/editor.py from hamzapehlivan/StyleRes: direct link, hf CLI and curl.
- Browser
- Download file 621 Bytes
-
https://huggingface.co/spaces/hamzapehlivan/StyleRes/resolve/main/editings/editor.py
- Command line
-
hf download hf://spaces/hamzapehlivan/StyleRes/editings/editor.py
-
curl -L -o editor.py https://huggingface.co/spaces/hamzapehlivan/StyleRes/resolve/main/editings/editor.py
621 Bytes
| 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) | |