Spaces:
Runtime error
Runtime error
File size: 796 Bytes
32b00b0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import inspect
import waifuc.export
from .config_manager import ConfigManager
class ExporterManager:
def __init__(self, config_manager: ConfigManager):
self.config_manager = config_manager
self.exporter_classes = [
cls for name, cls in inspect.getmembers(waifuc.export, inspect.isclass)
if name.endswith("Exporter") and not inspect.isabstract(cls)
]
self.exporter_names = [cls.__name__ for cls in self.exporter_classes]
def instantiate_exporter(self, selected_exporter, dataset_name):
exporter_cls = next(cls for cls in self.exporter_classes if cls.__name__ == selected_exporter)
output_dir = self.config_manager.get_config("output_dir")
return exporter_cls(dataset_name, path=output_dir)
|