from typing import Optional import gradio as gr from hfutils.repository import hf_hub_repo_url from imgutils.generic import MultiLabelTIMMModel KNOWN_MODELS = ['animetimm/swinv2_base_window8_256.e621v1-full'] SPECIAL_MODELS = {} def render_model_demo(repo_id, label: Optional[str] = None): label = label or repo_id.split('/')[-1] with gr.Tab(label): model = MultiLabelTIMMModel(repo_id=repo_id) with gr.Row(): with gr.Column(): repo_url = hf_hub_repo_url(repo_id=repo_id, repo_type='model') gr.Markdown(f'This is the quick demo for tagger model [{repo_id}]({repo_url}).') with gr.Row(): model.make_ui() if __name__ == '__main__': with gr.Blocks() as demo: with gr.Row(): with gr.Column(): gr.HTML(f'