|
import gradio as gr
|
|
import toml
|
|
from .class_gui_config import KohyaSSGUIConfig
|
|
|
|
class HuggingFace:
|
|
def __init__(
|
|
self,
|
|
config: KohyaSSGUIConfig,
|
|
) -> None:
|
|
self.config = config
|
|
|
|
|
|
self.initialize_ui_components()
|
|
|
|
def initialize_ui_components(self) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with gr.Row():
|
|
self.huggingface_repo_id = gr.Textbox(
|
|
label="Huggingface repo id",
|
|
placeholder="huggingface repo id",
|
|
value=self.config.get("huggingface.repo_id", ""),
|
|
)
|
|
|
|
self.huggingface_token = gr.Textbox(
|
|
label="Huggingface token",
|
|
placeholder="huggingface token",
|
|
value=self.config.get("huggingface.token", ""),
|
|
)
|
|
|
|
with gr.Row():
|
|
|
|
self.huggingface_repo_type = gr.Textbox(
|
|
label="Huggingface repo type",
|
|
placeholder="huggingface repo type",
|
|
value=self.config.get("huggingface.repo_type", ""),
|
|
)
|
|
|
|
self.huggingface_repo_visibility = gr.Textbox(
|
|
label="Huggingface repo visibility",
|
|
placeholder="huggingface repo visibility",
|
|
value=self.config.get("huggingface.repo_visibility", ""),
|
|
)
|
|
|
|
with gr.Row():
|
|
|
|
self.huggingface_path_in_repo = gr.Textbox(
|
|
label="Huggingface path in repo",
|
|
placeholder="huggingface path in repo",
|
|
value=self.config.get("huggingface.path_in_repo", ""),
|
|
)
|
|
|
|
with gr.Row():
|
|
|
|
self.save_state_to_huggingface = gr.Checkbox(
|
|
label="Save state to huggingface",
|
|
value=self.config.get("huggingface.save_state_to_huggingface", False),
|
|
)
|
|
|
|
self.resume_from_huggingface = gr.Textbox(
|
|
label="Resume from huggingface",
|
|
placeholder="resume from huggingface",
|
|
value=self.config.get("huggingface.resume_from_huggingface", ""),
|
|
)
|
|
|
|
self.async_upload = gr.Checkbox(
|
|
label="Async upload",
|
|
value=self.config.get("huggingface.async_upload", False),
|
|
) |