File size: 1,293 Bytes
3e7892f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51a4a67
 
 
 
3e7892f
51a4a67
3e7892f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fb6b5c4
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
import logging
import uuid
import shutil
from waifuc_gui.source_manager import SourceManager
from waifuc_gui.action_manager import ActionManager
from waifuc_gui.exporter_manager import ExporterManager
from waifuc_gui.file_handler import FileHandler
from waifuc_gui.interface import Interface
from waifuc_gui.config_manager import ConfigManager
import gradio as gr

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("waifuc_gui")
log_stream = []

class LogHandler(logging.Handler):
    def __init__(self):
        super().__init__()
        self.log_stream = log_stream

    def emit(self, record):
        self.log_stream.append(self.format(record))

log_handler = LogHandler()
log_handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(message)s"))
logger.addHandler(log_handler)

def main():
    session_id = str(uuid.uuid4())
    config_manager = ConfigManager(session_id)
    source_manager = SourceManager(config_manager)
    action_manager = ActionManager(config_manager)
    exporter_manager = ExporterManager(config_manager)
    file_handler = FileHandler()
    interface = Interface(source_manager, action_manager, exporter_manager, config_manager)

    ui = interface.build()
    ui["demo"].launch()

if __name__ == "__main__":
    main()