Upload 5 files
Browse files- app.py +19 -38
- lora_dict.json +98 -0
- modutils.py +156 -121
app.py
CHANGED
|
@@ -294,7 +294,7 @@ def get_my_lora(link_url):
|
|
| 294 |
new_lora_model_list.insert(0, "None")
|
| 295 |
|
| 296 |
return gr.update(
|
| 297 |
-
choices=get_lora_tupled_list(new_lora_model_list)
|
| 298 |
), gr.update(
|
| 299 |
choices=get_lora_tupled_list(new_lora_model_list)
|
| 300 |
), gr.update(
|
|
@@ -907,8 +907,8 @@ with gr.Blocks(theme="NoCrypt/miku", elem_id="main", css=CSS) as app:
|
|
| 907 |
with gr.Accordion("Negative prompt, etc.", open=False) as menu_negative:
|
| 908 |
neg_prompt_gui = gr.Textbox(lines=3, placeholder="lowres, (bad), ...", label="Negative prompt", show_copy_button=True)
|
| 909 |
#translate_prompt_button = gr.Button(value="Translate prompt to English", size="sm", variant="secondary")
|
| 910 |
-
|
| 911 |
-
|
| 912 |
prompt_type_gui = gr.Radio(label="Convert tags to", choices=["danbooru", "e621"], value="e621", visible=False)
|
| 913 |
prompt_type_button = gr.Button(value="Convert prompt to Pony e621 style", size="sm", variant="secondary")
|
| 914 |
with gr.Row():
|
|
@@ -1052,9 +1052,7 @@ with gr.Blocks(theme="NoCrypt/miku", elem_id="main", css=CSS) as app:
|
|
| 1052 |
vae_model_gui = gr.Dropdown(label="VAE Model", choices=vae_model_list)
|
| 1053 |
|
| 1054 |
with gr.Accordion("Hires fix", open=False, visible=True) as menu_hires:
|
| 1055 |
-
|
| 1056 |
upscaler_keys = list(upscaler_dict_gui.keys())
|
| 1057 |
-
|
| 1058 |
upscaler_model_path_gui = gr.Dropdown(label="Upscaler", choices=upscaler_keys, value=None)
|
| 1059 |
upscaler_increases_size_gui = gr.Slider(minimum=1.1, maximum=6., step=0.1, value=1.0, label="Upscale by")
|
| 1060 |
esrgan_tile_gui = gr.Slider(minimum=0, value=100, maximum=500, step=1, label="ESRGAN Tile")
|
|
@@ -1101,30 +1099,18 @@ with gr.Blocks(theme="NoCrypt/miku", elem_id="main", css=CSS) as app:
|
|
| 1101 |
lora5_trigger_gui = gr.Textbox(label="Lora5 prompts", info="Example of prompt", value="", show_copy_button=True, interactive=False, visible=False)
|
| 1102 |
lora5_copy_button = gr.Button(value="Copy example to prompt", visible=False)
|
| 1103 |
lora5_desc_gui = gr.Markdown(value="", visible=False)
|
| 1104 |
-
|
| 1105 |
with gr.Accordion("From URL", open=True, visible=True):
|
| 1106 |
text_lora = gr.Textbox(label="URL", placeholder="http://...my_lora_url.safetensors", lines=1)
|
| 1107 |
button_lora = gr.Button("Get and update lists of LoRAs")
|
| 1108 |
-
button_lora.click(
|
| 1109 |
-
get_my_lora,
|
| 1110 |
-
[text_lora],
|
| 1111 |
-
[lora1_gui, lora2_gui, lora3_gui, lora4_gui, lora5_gui]
|
| 1112 |
-
)
|
| 1113 |
with gr.Row():
|
| 1114 |
search_civitai_query_lora = gr.Textbox(label="Query", placeholder="oomuro sakurako...", lines=1)
|
| 1115 |
search_civitai_basemodel_lora = gr.CheckboxGroup(label="Search LoRA for", choices=["Pony", "SD 1.5", "SDXL 1.0"], value=["Pony", "SDXL 1.0"])
|
| 1116 |
search_civitai_button_lora = gr.Button("Search on Civitai")
|
| 1117 |
search_civitai_result_lora = gr.Dropdown(label="Search Results", choices=[("", "")], value="", allow_custom_value=True, visible=False)
|
| 1118 |
search_civitai_desc_lora = gr.Markdown(value="", visible=False)
|
| 1119 |
-
|
| 1120 |
with gr.Accordion("From Local", open=True, visible=True):
|
| 1121 |
file_output_lora = gr.File(label="Uploaded LoRA", file_types=['.ckpt', '.pt', '.pth', '.safetensors', '.bin'], file_count="multiple", interactive=False, visible=False)
|
| 1122 |
upload_button_lora = gr.UploadButton(label="Upload LoRA from your disk (very slow)", file_types=['.ckpt' , '.pt', '.pth', '.safetensors', '.bin'], file_count="multiple")
|
| 1123 |
-
upload_button_lora.upload(upload_file_lora, upload_button_lora, file_output_lora).success(
|
| 1124 |
-
move_file_lora,
|
| 1125 |
-
[file_output_lora],
|
| 1126 |
-
[lora1_gui, lora2_gui, lora3_gui, lora4_gui, lora5_gui]
|
| 1127 |
-
)
|
| 1128 |
|
| 1129 |
with gr.Accordion("IP-Adapter", open=False, visible=True) as menu_ipa:##############
|
| 1130 |
|
|
@@ -1650,15 +1636,15 @@ with gr.Blocks(theme="NoCrypt/miku", elem_id="main", css=CSS) as app:
|
|
| 1650 |
optimization_gui.change(set_optimization, [optimization_gui, steps_gui, cfg_gui, sampler_gui, clip_skip_gui, lora5_gui, lora_scale_5_gui], [steps_gui, cfg_gui, sampler_gui, clip_skip_gui, lora5_gui, lora_scale_5_gui])
|
| 1651 |
|
| 1652 |
lora1_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])\
|
| 1653 |
-
.then(set_lora_trigger, [lora1_gui], [lora1_trigger_gui, lora1_copy_button, lora1_desc_gui, lora1_gui])
|
| 1654 |
lora2_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])\
|
| 1655 |
-
.then(set_lora_trigger, [lora2_gui], [lora2_trigger_gui, lora2_copy_button, lora2_desc_gui, lora2_gui])
|
| 1656 |
lora3_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])\
|
| 1657 |
-
.then(set_lora_trigger, [lora3_gui], [lora3_trigger_gui, lora3_copy_button, lora3_desc_gui, lora3_gui])
|
| 1658 |
lora4_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])\
|
| 1659 |
-
.then(set_lora_trigger, [lora4_gui], [lora4_trigger_gui, lora4_copy_button, lora4_desc_gui, lora4_gui])
|
| 1660 |
lora5_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])\
|
| 1661 |
-
.then(set_lora_trigger, [lora5_gui], [lora5_trigger_gui, lora5_copy_button, lora5_desc_gui, lora5_gui])
|
| 1662 |
lora_scale_1_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])
|
| 1663 |
lora_scale_2_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])
|
| 1664 |
lora_scale_3_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])
|
|
@@ -1670,26 +1656,21 @@ with gr.Blocks(theme="NoCrypt/miku", elem_id="main", css=CSS) as app:
|
|
| 1670 |
lora3_copy_button.click(apply_lora_prompt, [prompt_gui, lora3_trigger_gui], [prompt_gui])
|
| 1671 |
lora4_copy_button.click(apply_lora_prompt, [prompt_gui, lora4_trigger_gui], [prompt_gui])
|
| 1672 |
lora5_copy_button.click(apply_lora_prompt, [prompt_gui, lora5_trigger_gui], [prompt_gui])
|
| 1673 |
-
|
| 1674 |
-
|
| 1675 |
-
search_civitai_lora,
|
| 1676 |
-
[search_civitai_query_lora, search_civitai_basemodel_lora],
|
| 1677 |
-
[search_civitai_result_lora, search_civitai_desc_lora],
|
| 1678 |
-
queue=True,
|
| 1679 |
show_progress="minimal",
|
| 1680 |
)
|
| 1681 |
-
|
| 1682 |
-
|
| 1683 |
-
|
| 1684 |
-
|
| 1685 |
-
|
|
|
|
| 1686 |
show_progress="minimal",
|
| 1687 |
)
|
| 1688 |
-
search_civitai_result_lora.change(
|
| 1689 |
-
select_civitai_lora,
|
| 1690 |
-
[search_civitai_result_lora],
|
| 1691 |
-
[text_lora, search_civitai_desc_lora],
|
| 1692 |
-
)
|
| 1693 |
|
| 1694 |
use_textual_inversion_gui.change(set_textual_inversion_prompt, [use_textual_inversion_gui, prompt_gui, neg_prompt_gui, prompt_syntax_gui], [prompt_gui, neg_prompt_gui])
|
| 1695 |
|
|
|
|
| 294 |
new_lora_model_list.insert(0, "None")
|
| 295 |
|
| 296 |
return gr.update(
|
| 297 |
+
choices=get_lora_tupled_list(new_lora_model_list), value=new_lora_model_list[-1]
|
| 298 |
), gr.update(
|
| 299 |
choices=get_lora_tupled_list(new_lora_model_list)
|
| 300 |
), gr.update(
|
|
|
|
| 907 |
with gr.Accordion("Negative prompt, etc.", open=False) as menu_negative:
|
| 908 |
neg_prompt_gui = gr.Textbox(lines=3, placeholder="lowres, (bad), ...", label="Negative prompt", show_copy_button=True)
|
| 909 |
#translate_prompt_button = gr.Button(value="Translate prompt to English", size="sm", variant="secondary")
|
| 910 |
+
insert_prompt_gui = gr.Radio(label="Insert reccomended positive / negative prompt", choices=["None", "Animagine", "Pony"], value="None", interactive=True, scale=2)
|
| 911 |
+
with gr.Accordion(label="Advanced options", open=False):
|
| 912 |
prompt_type_gui = gr.Radio(label="Convert tags to", choices=["danbooru", "e621"], value="e621", visible=False)
|
| 913 |
prompt_type_button = gr.Button(value="Convert prompt to Pony e621 style", size="sm", variant="secondary")
|
| 914 |
with gr.Row():
|
|
|
|
| 1052 |
vae_model_gui = gr.Dropdown(label="VAE Model", choices=vae_model_list)
|
| 1053 |
|
| 1054 |
with gr.Accordion("Hires fix", open=False, visible=True) as menu_hires:
|
|
|
|
| 1055 |
upscaler_keys = list(upscaler_dict_gui.keys())
|
|
|
|
| 1056 |
upscaler_model_path_gui = gr.Dropdown(label="Upscaler", choices=upscaler_keys, value=None)
|
| 1057 |
upscaler_increases_size_gui = gr.Slider(minimum=1.1, maximum=6., step=0.1, value=1.0, label="Upscale by")
|
| 1058 |
esrgan_tile_gui = gr.Slider(minimum=0, value=100, maximum=500, step=1, label="ESRGAN Tile")
|
|
|
|
| 1099 |
lora5_trigger_gui = gr.Textbox(label="Lora5 prompts", info="Example of prompt", value="", show_copy_button=True, interactive=False, visible=False)
|
| 1100 |
lora5_copy_button = gr.Button(value="Copy example to prompt", visible=False)
|
| 1101 |
lora5_desc_gui = gr.Markdown(value="", visible=False)
|
|
|
|
| 1102 |
with gr.Accordion("From URL", open=True, visible=True):
|
| 1103 |
text_lora = gr.Textbox(label="URL", placeholder="http://...my_lora_url.safetensors", lines=1)
|
| 1104 |
button_lora = gr.Button("Get and update lists of LoRAs")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1105 |
with gr.Row():
|
| 1106 |
search_civitai_query_lora = gr.Textbox(label="Query", placeholder="oomuro sakurako...", lines=1)
|
| 1107 |
search_civitai_basemodel_lora = gr.CheckboxGroup(label="Search LoRA for", choices=["Pony", "SD 1.5", "SDXL 1.0"], value=["Pony", "SDXL 1.0"])
|
| 1108 |
search_civitai_button_lora = gr.Button("Search on Civitai")
|
| 1109 |
search_civitai_result_lora = gr.Dropdown(label="Search Results", choices=[("", "")], value="", allow_custom_value=True, visible=False)
|
| 1110 |
search_civitai_desc_lora = gr.Markdown(value="", visible=False)
|
|
|
|
| 1111 |
with gr.Accordion("From Local", open=True, visible=True):
|
| 1112 |
file_output_lora = gr.File(label="Uploaded LoRA", file_types=['.ckpt', '.pt', '.pth', '.safetensors', '.bin'], file_count="multiple", interactive=False, visible=False)
|
| 1113 |
upload_button_lora = gr.UploadButton(label="Upload LoRA from your disk (very slow)", file_types=['.ckpt' , '.pt', '.pth', '.safetensors', '.bin'], file_count="multiple")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1114 |
|
| 1115 |
with gr.Accordion("IP-Adapter", open=False, visible=True) as menu_ipa:##############
|
| 1116 |
|
|
|
|
| 1636 |
optimization_gui.change(set_optimization, [optimization_gui, steps_gui, cfg_gui, sampler_gui, clip_skip_gui, lora5_gui, lora_scale_5_gui], [steps_gui, cfg_gui, sampler_gui, clip_skip_gui, lora5_gui, lora_scale_5_gui])
|
| 1637 |
|
| 1638 |
lora1_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])\
|
| 1639 |
+
.then(set_lora_trigger, [lora1_gui], [lora1_trigger_gui, lora1_copy_button, lora1_desc_gui, lora1_gui], scroll_to_output=True)
|
| 1640 |
lora2_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])\
|
| 1641 |
+
.then(set_lora_trigger, [lora2_gui], [lora2_trigger_gui, lora2_copy_button, lora2_desc_gui, lora2_gui], scroll_to_output=True)
|
| 1642 |
lora3_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])\
|
| 1643 |
+
.then(set_lora_trigger, [lora3_gui], [lora3_trigger_gui, lora3_copy_button, lora3_desc_gui, lora3_gui], scroll_to_output=True)
|
| 1644 |
lora4_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])\
|
| 1645 |
+
.then(set_lora_trigger, [lora4_gui], [lora4_trigger_gui, lora4_copy_button, lora4_desc_gui, lora4_gui], scroll_to_output=True)
|
| 1646 |
lora5_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])\
|
| 1647 |
+
.then(set_lora_trigger, [lora5_gui], [lora5_trigger_gui, lora5_copy_button, lora5_desc_gui, lora5_gui], scroll_to_output=True)
|
| 1648 |
lora_scale_1_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])
|
| 1649 |
lora_scale_2_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])
|
| 1650 |
lora_scale_3_gui.change(set_lora_prompt, [prompt_gui, prompt_syntax_gui, lora1_gui, lora_scale_1_gui, lora2_gui, lora_scale_2_gui, lora3_gui, lora_scale_3_gui, lora4_gui, lora_scale_4_gui, lora5_gui, lora_scale_5_gui], [prompt_gui])
|
|
|
|
| 1656 |
lora3_copy_button.click(apply_lora_prompt, [prompt_gui, lora3_trigger_gui], [prompt_gui])
|
| 1657 |
lora4_copy_button.click(apply_lora_prompt, [prompt_gui, lora4_trigger_gui], [prompt_gui])
|
| 1658 |
lora5_copy_button.click(apply_lora_prompt, [prompt_gui, lora5_trigger_gui], [prompt_gui])
|
| 1659 |
+
gr.on(
|
| 1660 |
+
triggers=[search_civitai_button_lora.click, search_civitai_query_lora.submit],
|
| 1661 |
+
fn=search_civitai_lora,
|
| 1662 |
+
inputs=[search_civitai_query_lora, search_civitai_basemodel_lora],
|
| 1663 |
+
outputs=[search_civitai_result_lora, search_civitai_desc_lora],
|
|
|
|
| 1664 |
show_progress="minimal",
|
| 1665 |
)
|
| 1666 |
+
search_civitai_result_lora.change(select_civitai_lora, [search_civitai_result_lora], [text_lora, search_civitai_desc_lora])
|
| 1667 |
+
button_lora.click(get_my_lora, [text_lora], [lora1_gui, lora2_gui, lora3_gui, lora4_gui, lora5_gui])
|
| 1668 |
+
upload_button_lora.upload(upload_file_lora, upload_button_lora, file_output_lora, show_progress="minimal").success(
|
| 1669 |
+
move_file_lora,
|
| 1670 |
+
[file_output_lora],
|
| 1671 |
+
[lora1_gui, lora2_gui, lora3_gui, lora4_gui, lora5_gui],
|
| 1672 |
show_progress="minimal",
|
| 1673 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1674 |
|
| 1675 |
use_textual_inversion_gui.change(set_textual_inversion_prompt, [use_textual_inversion_gui, prompt_gui, neg_prompt_gui, prompt_syntax_gui], [prompt_gui, neg_prompt_gui])
|
| 1676 |
|
lora_dict.json
CHANGED
|
@@ -230,6 +230,13 @@
|
|
| 230 |
"https://civitai.com/models/547794",
|
| 231 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/574d516b-f2f7-465f-850c-6ad1730aa746/width=450/17847694.jpeg"
|
| 232 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
"Cat_Costume_Pony": [
|
| 234 |
"cat costume",
|
| 235 |
"Pony",
|
|
@@ -300,6 +307,13 @@
|
|
| 300 |
"https://civitai.com/models/17610",
|
| 301 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/ce7d0709-f4e0-4183-bcf1-f2091470503b/width=450/8866158.jpeg"
|
| 302 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
"Defloration": [
|
| 304 |
"Defloration / Defloration by Penis / After Defloration / Cum in Pussy",
|
| 305 |
"Pony",
|
|
@@ -622,6 +636,13 @@
|
|
| 622 |
"https://civitai.com/models/550384",
|
| 623 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/a337f088-579c-4713-9424-2c3f2b9530ed/width=450/18019685.jpeg"
|
| 624 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 625 |
"MdaStarouXL_P6_lokr_V4312NF": [
|
| 626 |
"",
|
| 627 |
"Pony",
|
|
@@ -1252,6 +1273,13 @@
|
|
| 1252 |
"https://civitai.com/models/526774",
|
| 1253 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/b40d42c4-66df-4c6e-9351-2b0343007979/width=450/16455415.jpeg"
|
| 1254 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1255 |
"asanagiArtistStylePonyxl_dora": [
|
| 1256 |
"",
|
| 1257 |
"Pony",
|
|
@@ -1546,6 +1574,13 @@
|
|
| 1546 |
"https://civitai.com/models/526757",
|
| 1547 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/d1d557b6-4b95-4b82-94eb-5ca367e71d90/width=450/16452076.jpeg"
|
| 1548 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1549 |
"cat_girl_pony_v21": [
|
| 1550 |
"nekomata, cat girl, cat ears, animal ears, animal ear fluff",
|
| 1551 |
"Pony",
|
|
@@ -1567,6 +1602,13 @@
|
|
| 1567 |
"https://civitai.com/models/476691",
|
| 1568 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/e2c7f23f-fa78-4121-9ed7-37944c025ada/width=450/13846218.jpeg"
|
| 1569 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1570 |
"cheerleader_XL_V1_0": [
|
| 1571 |
"jyojifuku, cheerleader, pom pom \\(cheerleading\\)",
|
| 1572 |
"SDXL 1.0",
|
|
@@ -1868,6 +1910,13 @@
|
|
| 1868 |
"https://civitai.com/models/521379",
|
| 1869 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/2e4a4ce2-1da9-40f6-be94-16e4cf5f8c1a/width=450/16141376.jpeg"
|
| 1870 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1871 |
"fisting_pony_V1_0": [
|
| 1872 |
"fisting / vaginal / anal",
|
| 1873 |
"Pony",
|
|
@@ -2344,6 +2393,13 @@
|
|
| 2344 |
"https://civitai.com/models/458386",
|
| 2345 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/a19e2608-4612-408a-9937-35c03b5e5947/width=450/12644488.jpeg"
|
| 2346 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2347 |
"loose_socks_XL_V1_1": [
|
| 2348 |
"jyojifuku,loose socks / school uniform",
|
| 2349 |
"SDXL 1.0",
|
|
@@ -2463,6 +2519,13 @@
|
|
| 2463 |
"https://civitai.com/models/488098",
|
| 2464 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/58767062-22a1-4f52-ac2e-7f01fae26908/width=450/14206684.jpeg"
|
| 2465 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2466 |
"menstrual_pad_XL": [
|
| 2467 |
"menstrual_pad / panties",
|
| 2468 |
"Pony",
|
|
@@ -3002,6 +3065,20 @@
|
|
| 3002 |
"https://civitai.com/models/451983",
|
| 3003 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/a239680f-38bb-456c-89f2-e87505162cf2/width=450/12311203.jpeg"
|
| 3004 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3005 |
"reel-XL-v2-ep20": [
|
| 3006 |
"",
|
| 3007 |
"SDXL 1.0",
|
|
@@ -3219,6 +3296,13 @@
|
|
| 3219 |
"https://civitai.com/models/196347",
|
| 3220 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/0566083e-39fd-46b5-964d-86f69b2f24b0/width=450/3534457.jpeg"
|
| 3221 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3222 |
"slurpingcum_locon_v1": [
|
| 3223 |
"slurpingcum, gokkun, cupping hands, own hands together, cum on hands, hands up, drinking",
|
| 3224 |
"Pony",
|
|
@@ -3226,6 +3310,13 @@
|
|
| 3226 |
"https://civitai.com/models/512829",
|
| 3227 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/efd73ff0-bf53-4e63-a898-ea65ff03e228/width=450/15633329.jpeg"
|
| 3228 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3229 |
"spagainstScreenXLPony": [
|
| 3230 |
"against glass, breast press, cheek press",
|
| 3231 |
"Pony",
|
|
@@ -3394,6 +3485,13 @@
|
|
| 3394 |
"https://civitai.com/models/12542",
|
| 3395 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/c7d19f74-7fab-46ed-ae96-231d12092adc/width=450/8220286.jpeg"
|
| 3396 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3397 |
"tehepero_XL_v1": [
|
| 3398 |
"tehepero, dojikko pose",
|
| 3399 |
"SDXL 1.0",
|
|
|
|
| 230 |
"https://civitai.com/models/547794",
|
| 231 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/574d516b-f2f7-465f-850c-6ad1730aa746/width=450/17847694.jpeg"
|
| 232 |
],
|
| 233 |
+
"Cage_Sex": [
|
| 234 |
+
"inside cage",
|
| 235 |
+
"Pony",
|
| 236 |
+
"Cage Sex Fetish",
|
| 237 |
+
"https://civitai.com/models/551923",
|
| 238 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/20da4500-1f88-4a9e-9398-e19a119495de/width=450/18161397.jpeg"
|
| 239 |
+
],
|
| 240 |
"Cat_Costume_Pony": [
|
| 241 |
"cat costume",
|
| 242 |
"Pony",
|
|
|
|
| 307 |
"https://civitai.com/models/17610",
|
| 308 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/ce7d0709-f4e0-4183-bcf1-f2091470503b/width=450/8866158.jpeg"
|
| 309 |
],
|
| 310 |
+
"Curtsey": [
|
| 311 |
+
"Curtsey / FULLBODY, LONG DRESS / KNEES BENT, FEET CROSSED, BOWING",
|
| 312 |
+
"SDXL 1.0",
|
| 313 |
+
"Curtsey | Lift Dress Bow",
|
| 314 |
+
"https://civitai.com/models/550529",
|
| 315 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/4b4a2f69-4fec-478f-8e5f-67418f056ee7/width=450/18140555.jpeg"
|
| 316 |
+
],
|
| 317 |
"Defloration": [
|
| 318 |
"Defloration / Defloration by Penis / After Defloration / Cum in Pussy",
|
| 319 |
"Pony",
|
|
|
|
| 636 |
"https://civitai.com/models/550384",
|
| 637 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/a337f088-579c-4713-9424-2c3f2b9530ed/width=450/18019685.jpeg"
|
| 638 |
],
|
| 639 |
+
"MdaStarouXL_ANI31_lokr_V43P1NF": [
|
| 640 |
+
"",
|
| 641 |
+
"SDXL 1.0",
|
| 642 |
+
"[SDXL] Artist Style: Mda Starou/M\u3060S\u305f\u308d\u3046",
|
| 643 |
+
"https://civitai.com/models/544619",
|
| 644 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/25f6a02a-9793-4d59-8279-51a12bc01fbb/width=450/18209541.jpeg"
|
| 645 |
+
],
|
| 646 |
"MdaStarouXL_P6_lokr_V4312NF": [
|
| 647 |
"",
|
| 648 |
"Pony",
|
|
|
|
| 1273 |
"https://civitai.com/models/526774",
|
| 1274 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/b40d42c4-66df-4c6e-9351-2b0343007979/width=450/16455415.jpeg"
|
| 1275 |
],
|
| 1276 |
+
"asanagi": [
|
| 1277 |
+
"4s4n4g1",
|
| 1278 |
+
"Pony",
|
| 1279 |
+
"Oktaze's Hentai Pony Styles Collection",
|
| 1280 |
+
"https://civitai.com/models/549761",
|
| 1281 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/ce41c563-2180-4e57-beea-199db558ff65/width=450/18155333.jpeg"
|
| 1282 |
+
],
|
| 1283 |
"asanagiArtistStylePonyxl_dora": [
|
| 1284 |
"",
|
| 1285 |
"Pony",
|
|
|
|
| 1574 |
"https://civitai.com/models/526757",
|
| 1575 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/d1d557b6-4b95-4b82-94eb-5ca367e71d90/width=450/16452076.jpeg"
|
| 1576 |
],
|
| 1577 |
+
"car_trunk_pony_v1_0a": [
|
| 1578 |
+
"hd5,car_trunk",
|
| 1579 |
+
"Pony",
|
| 1580 |
+
"Car Trunk concept | Pony",
|
| 1581 |
+
"https://civitai.com/models/553281",
|
| 1582 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/8f82bc88-60a1-478f-a0cf-2d961a791e45/width=450/18213320.jpeg"
|
| 1583 |
+
],
|
| 1584 |
"cat_girl_pony_v21": [
|
| 1585 |
"nekomata, cat girl, cat ears, animal ears, animal ear fluff",
|
| 1586 |
"Pony",
|
|
|
|
| 1602 |
"https://civitai.com/models/476691",
|
| 1603 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/e2c7f23f-fa78-4121-9ed7-37944c025ada/width=450/13846218.jpeg"
|
| 1604 |
],
|
| 1605 |
+
"checkpoint-e94_s752": [
|
| 1606 |
+
"cute, kawaii, cutecore, kawaiicore, cutegore, kawaiigore, colorful stars, pastel colors, hearts, rainbow, rainbow text",
|
| 1607 |
+
"Pony",
|
| 1608 |
+
"cutecore/kawaiicore/cutegore/kawaiigore edits style ! (for PonyXL)",
|
| 1609 |
+
"https://civitai.com/models/553231",
|
| 1610 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/fa0c6d2b-b873-4a6d-8300-b57b67665711/width=450/18205337.jpeg"
|
| 1611 |
+
],
|
| 1612 |
"cheerleader_XL_V1_0": [
|
| 1613 |
"jyojifuku, cheerleader, pom pom \\(cheerleading\\)",
|
| 1614 |
"SDXL 1.0",
|
|
|
|
| 1910 |
"https://civitai.com/models/521379",
|
| 1911 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/2e4a4ce2-1da9-40f6-be94-16e4cf5f8c1a/width=450/16141376.jpeg"
|
| 1912 |
],
|
| 1913 |
+
"fingering_pony_V1_0": [
|
| 1914 |
+
"fingering",
|
| 1915 |
+
"Pony",
|
| 1916 |
+
"\u30d5\u30a3\u30f3\u30ac\u30ea\u30f3\u30b0/fingering",
|
| 1917 |
+
"https://civitai.com/models/551963",
|
| 1918 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/f664aca0-7a27-434b-b3bf-9d748c892b99/width=450/18124227.jpeg"
|
| 1919 |
+
],
|
| 1920 |
"fisting_pony_V1_0": [
|
| 1921 |
"fisting / vaginal / anal",
|
| 1922 |
"Pony",
|
|
|
|
| 2393 |
"https://civitai.com/models/458386",
|
| 2394 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/a19e2608-4612-408a-9937-35c03b5e5947/width=450/12644488.jpeg"
|
| 2395 |
],
|
| 2396 |
+
"lollipop_Pony_v1": [
|
| 2397 |
+
"lollipop",
|
| 2398 |
+
"Pony",
|
| 2399 |
+
"[SDXL&Pony] lollipop / Chupa Chups / \u30ed\u30ea\u30dd\u30c3\u30d7 / \u30da\u30ed\u30da\u30ed\u30ad\u30e3\u30f3\u30c7\u30a3 / \u30c1\u30e5\u30c3\u30d1\u30c1\u30e3\u30c3\u30d7\u30b9",
|
| 2400 |
+
"https://civitai.com/models/292798",
|
| 2401 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/95169a25-d709-46fa-86e9-801a959a592b/width=450/18155754.jpeg"
|
| 2402 |
+
],
|
| 2403 |
"loose_socks_XL_V1_1": [
|
| 2404 |
"jyojifuku,loose socks / school uniform",
|
| 2405 |
"SDXL 1.0",
|
|
|
|
| 2519 |
"https://civitai.com/models/488098",
|
| 2520 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/58767062-22a1-4f52-ac2e-7f01fae26908/width=450/14206684.jpeg"
|
| 2521 |
],
|
| 2522 |
+
"maron_maron__kotosanomaa": [
|
| 2523 |
+
"m4r0n_m4r0n",
|
| 2524 |
+
"Pony",
|
| 2525 |
+
"Oktaze's Hentai Pony Styles Collection",
|
| 2526 |
+
"https://civitai.com/models/549761",
|
| 2527 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/5059fb4e-8cb0-4870-babe-2e62d93ec592/width=450/18112025.jpeg"
|
| 2528 |
+
],
|
| 2529 |
"menstrual_pad_XL": [
|
| 2530 |
"menstrual_pad / panties",
|
| 2531 |
"Pony",
|
|
|
|
| 3065 |
"https://civitai.com/models/451983",
|
| 3066 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/a239680f-38bb-456c-89f2-e87505162cf2/width=450/12311203.jpeg"
|
| 3067 |
],
|
| 3068 |
+
"recorderXLv1": [
|
| 3069 |
+
"recorder,",
|
| 3070 |
+
"SDXL 1.0",
|
| 3071 |
+
"[SDXL&Pony] recorder / \u30ea\u30b3\u30fc\u30c0\u30fc",
|
| 3072 |
+
"https://civitai.com/models/297814",
|
| 3073 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/b35ad39b-a10f-448f-bd73-f024b9375a2a/width=450/6406129.jpeg"
|
| 3074 |
+
],
|
| 3075 |
+
"recorder_Pony_v1": [
|
| 3076 |
+
"recorder",
|
| 3077 |
+
"Pony",
|
| 3078 |
+
"[SDXL&Pony] recorder / \u30ea\u30b3\u30fc\u30c0\u30fc",
|
| 3079 |
+
"https://civitai.com/models/297814",
|
| 3080 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/e2146f98-f65e-4f86-a4af-401bc5c9229b/width=450/18126719.jpeg"
|
| 3081 |
+
],
|
| 3082 |
"reel-XL-v2-ep20": [
|
| 3083 |
"",
|
| 3084 |
"SDXL 1.0",
|
|
|
|
| 3296 |
"https://civitai.com/models/196347",
|
| 3297 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/0566083e-39fd-46b5-964d-86f69b2f24b0/width=450/3534457.jpeg"
|
| 3298 |
],
|
| 3299 |
+
"skirt_tug": [
|
| 3300 |
+
"skirt tug",
|
| 3301 |
+
"Pony",
|
| 3302 |
+
"skirt tug",
|
| 3303 |
+
"https://civitai.com/models/551940",
|
| 3304 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/92934659-099b-4b4a-8f61-b4a94e1cf951/width=450/18122948.jpeg"
|
| 3305 |
+
],
|
| 3306 |
"slurpingcum_locon_v1": [
|
| 3307 |
"slurpingcum, gokkun, cupping hands, own hands together, cum on hands, hands up, drinking",
|
| 3308 |
"Pony",
|
|
|
|
| 3310 |
"https://civitai.com/models/512829",
|
| 3311 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/efd73ff0-bf53-4e63-a898-ea65ff03e228/width=450/15633329.jpeg"
|
| 3312 |
],
|
| 3313 |
+
"soapland_PONY_V2": [
|
| 3314 |
+
"soapland, scenery, sink, scenery, towel, mirror, indoors, faucet, bathroom, window, soap bottle, shelf, cup, reflection, bottle, shadow, tiles, door, sunlight, cabinet, toothbrush, bathtub, bath stool, kuguriisu,",
|
| 3315 |
+
"Pony",
|
| 3316 |
+
"\u7279\u6b8a\u6d74\u5834 (SoapLand) / PONY",
|
| 3317 |
+
"https://civitai.com/models/552152",
|
| 3318 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/9ee78490-d6c5-45c1-a1a0-92cb965faa10/width=450/18135129.jpeg"
|
| 3319 |
+
],
|
| 3320 |
"spagainstScreenXLPony": [
|
| 3321 |
"against glass, breast press, cheek press",
|
| 3322 |
"Pony",
|
|
|
|
| 3485 |
"https://civitai.com/models/12542",
|
| 3486 |
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/c7d19f74-7fab-46ed-ae96-231d12092adc/width=450/8220286.jpeg"
|
| 3487 |
],
|
| 3488 |
+
"takorin": [
|
| 3489 |
+
"t4k0r1n",
|
| 3490 |
+
"Pony",
|
| 3491 |
+
"Oktaze's Hentai Pony Styles Collection",
|
| 3492 |
+
"https://civitai.com/models/549761",
|
| 3493 |
+
"https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/30be2c21-3373-4640-b3cc-8d341d4480e7/width=450/18120705.jpeg"
|
| 3494 |
+
],
|
| 3495 |
"tehepero_XL_v1": [
|
| 3496 |
"tehepero, dojikko pose",
|
| 3497 |
"SDXL 1.0",
|
modutils.py
CHANGED
|
@@ -2,7 +2,8 @@ import os
|
|
| 2 |
import json
|
| 3 |
import gradio as gr
|
| 4 |
from PIL import Image
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
HF_LORA_PRIVATE_REPOS = ['John6666/loratest1', 'John6666/loratest3', 'John6666/loratest4', 'John6666/loratest6', 'John6666/loratest10', 'John6666/loratest']
|
| 8 |
HF_LORA_ESSENTIAL_PRIVATE_REPO = 'John6666/loratest1'
|
|
@@ -76,13 +77,17 @@ def download_private_repo(repo_id, dir_path, is_replace):
|
|
| 76 |
from huggingface_hub import snapshot_download
|
| 77 |
hf_read_token = os.environ.get('HF_READ_TOKEN')
|
| 78 |
if not hf_read_token: return
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
|
| 88 |
private_model_path_repo_dict = {}
|
|
@@ -90,20 +95,23 @@ private_model_path_repo_dict = {}
|
|
| 90 |
|
| 91 |
def get_private_model_list(repo_id, dir_path):
|
| 92 |
global private_model_path_repo_dict
|
| 93 |
-
from huggingface_hub import HfApi
|
| 94 |
api = HfApi()
|
| 95 |
hf_read_token = os.environ.get('HF_READ_TOKEN')
|
| 96 |
if not hf_read_token: return []
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
|
| 109 |
def get_private_model_lists(repo_id_list, dir_path):
|
|
@@ -123,9 +131,13 @@ def download_private_file(repo_id, path, is_replace):
|
|
| 123 |
if not hf_read_token or newpath.exists(): return
|
| 124 |
filename = file.name
|
| 125 |
dirname = file.parent.name
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
|
| 131 |
def download_private_file_from_somewhere(path, is_replace):
|
|
@@ -135,79 +147,79 @@ def download_private_file_from_somewhere(path, is_replace):
|
|
| 135 |
|
| 136 |
|
| 137 |
def get_model_id_list():
|
| 138 |
-
from huggingface_hub import HfApi
|
| 139 |
api = HfApi()
|
| 140 |
model_ids = []
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
return model_ids
|
| 158 |
|
| 159 |
|
| 160 |
def get_t2i_model_info(repo_id: str):
|
| 161 |
-
from huggingface_hub import HfApi
|
| 162 |
api = HfApi()
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
if model.private or model.gated: return ""
|
| 166 |
-
|
| 167 |
-
tags = model.tags
|
| 168 |
-
info = []
|
| 169 |
-
url = f"https://huggingface.co/{repo_id}/"
|
| 170 |
-
if not 'diffusers' in tags: return ""
|
| 171 |
-
if 'diffusers:StableDiffusionXLPipeline' in tags:
|
| 172 |
-
info.append("SDXL")
|
| 173 |
-
elif 'diffusers:StableDiffusionPipeline' in tags:
|
| 174 |
-
info.append("SD1.5")
|
| 175 |
-
if model.card_data and model.card_data.tags:
|
| 176 |
-
info.extend(list_sub(model.card_data.tags, ['text-to-image', 'stable-diffusion', 'stable-diffusion-api', 'safetensors', 'stable-diffusion-xl']))
|
| 177 |
-
info.append(f"DLs: {model.downloads}")
|
| 178 |
-
info.append(f"likes: {model.likes}")
|
| 179 |
-
info.append(model.last_modified.strftime("lastmod: %Y-%m-%d"))
|
| 180 |
-
|
| 181 |
-
md = f"Model Info: {', '.join(info)}, [Model Repo]({url})"
|
| 182 |
-
return gr.update(value=md)
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
def get_tupled_model_list(model_list):
|
| 186 |
-
if not model_list: return []
|
| 187 |
-
tupled_list = []
|
| 188 |
-
for repo_id in model_list:
|
| 189 |
-
from huggingface_hub import HfApi
|
| 190 |
-
api = HfApi()
|
| 191 |
-
if not api.repo_exists(repo_id): continue
|
| 192 |
model = api.model_info(repo_id=repo_id)
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
| 195 |
tags = model.tags
|
| 196 |
info = []
|
| 197 |
-
|
|
|
|
| 198 |
if 'diffusers:StableDiffusionXLPipeline' in tags:
|
| 199 |
info.append("SDXL")
|
| 200 |
elif 'diffusers:StableDiffusionPipeline' in tags:
|
| 201 |
info.append("SD1.5")
|
| 202 |
if model.card_data and model.card_data.tags:
|
| 203 |
info.extend(list_sub(model.card_data.tags, ['text-to-image', 'stable-diffusion', 'stable-diffusion-api', 'safetensors', 'stable-diffusion-xl']))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
else:
|
| 209 |
-
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
return tupled_list
|
| 212 |
|
| 213 |
|
|
@@ -319,6 +331,8 @@ civitai_not_exists_list = []
|
|
| 319 |
def get_civitai_info(path):
|
| 320 |
global civitai_not_exists_list
|
| 321 |
import requests
|
|
|
|
|
|
|
| 322 |
if path in set(civitai_not_exists_list): return ["", "", "", "", ""]
|
| 323 |
from pathlib import Path
|
| 324 |
if not Path(path).exists(): return None
|
|
@@ -326,24 +340,31 @@ def get_civitai_info(path):
|
|
| 326 |
headers = {'User-Agent': user_agent, 'content-type': 'application/json'}
|
| 327 |
base_url = 'https://civitai.com/api/v1/model-versions/by-hash/'
|
| 328 |
params = {}
|
|
|
|
|
|
|
|
|
|
| 329 |
import hashlib
|
| 330 |
with open(path, 'rb') as file:
|
| 331 |
file_data = file.read()
|
| 332 |
hash_sha256 = hashlib.sha256(file_data).hexdigest()
|
| 333 |
url = base_url + hash_sha256
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
if not 'baseModel' in json:
|
| 338 |
-
civitai_not_exists_list.append(path)
|
| 339 |
return ["", "", "", "", ""]
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
|
| 348 |
|
| 349 |
def update_lora_dict(path):
|
|
@@ -443,6 +464,7 @@ def upload_file_lora(files):
|
|
| 443 |
file_paths = [file.name for file in files]
|
| 444 |
return gr.update(value=file_paths, visible=True)
|
| 445 |
|
|
|
|
| 446 |
def move_file_lora(filepaths):
|
| 447 |
import shutil
|
| 448 |
from pathlib import Path
|
|
@@ -456,7 +478,7 @@ def move_file_lora(filepaths):
|
|
| 456 |
new_lora_model_list.insert(0, "None")
|
| 457 |
|
| 458 |
return gr.update(
|
| 459 |
-
choices=get_lora_tupled_list(new_lora_model_list)
|
| 460 |
), gr.update(
|
| 461 |
choices=get_lora_tupled_list(new_lora_model_list)
|
| 462 |
), gr.update(
|
|
@@ -470,30 +492,39 @@ def move_file_lora(filepaths):
|
|
| 470 |
|
| 471 |
def search_lora_on_civitai(query: str, allow_model: list[str]):
|
| 472 |
import requests
|
|
|
|
|
|
|
| 473 |
if not query: return None
|
| 474 |
user_agent = get_user_agent()
|
| 475 |
headers = {'User-Agent': user_agent, 'content-type': 'application/json'}
|
| 476 |
base_url = 'https://civitai.com/api/v1/models'
|
| 477 |
params = {'query': query, 'types': ['LORA'], 'sort': 'Highest Rated', 'period': 'AllTime',
|
| 478 |
'nsfw': 'true'}
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 497 |
|
| 498 |
|
| 499 |
civitai_lora_last_results = {}
|
|
@@ -507,7 +538,7 @@ def search_civitai_lora(query, base_model):
|
|
| 507 |
choices = []
|
| 508 |
for item in items:
|
| 509 |
base_model_name = "Pony🐴" if item['base_model'] == "Pony" else item['base_model']
|
| 510 |
-
name = f"{item['name']} (for {base_model_name} / By {item['creator']} / Tags
|
| 511 |
value = item['dl_url']
|
| 512 |
choices.append((name, value))
|
| 513 |
civitai_lora_last_results[value] = item['md']
|
|
@@ -819,15 +850,19 @@ def get_model_pipeline(repo_id: str):
|
|
| 819 |
from huggingface_hub import HfApi
|
| 820 |
api = HfApi()
|
| 821 |
default = "StableDiffusionPipeline"
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
tags = model.tags
|
| 827 |
-
if not 'diffusers' in tags: return default
|
| 828 |
-
if 'diffusers:StableDiffusionXLPipeline' in tags:
|
| 829 |
-
return "StableDiffusionXLPipeline"
|
| 830 |
-
elif 'diffusers:StableDiffusionPipeline' in tags:
|
| 831 |
-
return "StableDiffusionPipeline"
|
| 832 |
-
else:
|
| 833 |
return default
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import json
|
| 3 |
import gradio as gr
|
| 4 |
from PIL import Image
|
| 5 |
+
from huggingface_hub import HfApi
|
| 6 |
+
from requests import HTTPError, Timeout
|
| 7 |
|
| 8 |
HF_LORA_PRIVATE_REPOS = ['John6666/loratest1', 'John6666/loratest3', 'John6666/loratest4', 'John6666/loratest6', 'John6666/loratest10', 'John6666/loratest']
|
| 9 |
HF_LORA_ESSENTIAL_PRIVATE_REPO = 'John6666/loratest1'
|
|
|
|
| 77 |
from huggingface_hub import snapshot_download
|
| 78 |
hf_read_token = os.environ.get('HF_READ_TOKEN')
|
| 79 |
if not hf_read_token: return
|
| 80 |
+
try:
|
| 81 |
+
snapshot_download(repo_id=repo_id, local_dir=dir_path, allow_patterns=['*.ckpt', '*.pt', '*.pth', '*.safetensors', '*.bin'], use_auth_token=hf_read_token)
|
| 82 |
+
except (EnvironmentError, OSError, ValueError, HTTPError, Timeout) as e:
|
| 83 |
+
return
|
| 84 |
+
else:
|
| 85 |
+
if is_replace:
|
| 86 |
+
from pathlib import Path
|
| 87 |
+
for file in Path(dir_path).glob("*"):
|
| 88 |
+
if file.exists() and "." in file.stem or " " in file.stem and file.suffix in ['.ckpt', '.pt', '.pth', '.safetensors', '.bin']:
|
| 89 |
+
newpath = Path(f'{file.parent.name}/{escape_lora_basename(file.stem)}{file.suffix}')
|
| 90 |
+
file.rename(newpath)
|
| 91 |
|
| 92 |
|
| 93 |
private_model_path_repo_dict = {}
|
|
|
|
| 95 |
|
| 96 |
def get_private_model_list(repo_id, dir_path):
|
| 97 |
global private_model_path_repo_dict
|
|
|
|
| 98 |
api = HfApi()
|
| 99 |
hf_read_token = os.environ.get('HF_READ_TOKEN')
|
| 100 |
if not hf_read_token: return []
|
| 101 |
+
try:
|
| 102 |
+
files = api.list_repo_files(repo_id, token=hf_read_token)
|
| 103 |
+
except (EnvironmentError, OSError, ValueError, HTTPError, Timeout) as e:
|
| 104 |
+
return []
|
| 105 |
+
else:
|
| 106 |
+
model_list = []
|
| 107 |
+
for file in files:
|
| 108 |
+
from pathlib import Path
|
| 109 |
+
path = Path(f"{dir_path}/{file}")
|
| 110 |
+
if path.suffix in ['.ckpt', '.pt', '.pth', '.safetensors', '.bin']:
|
| 111 |
+
model_list.append(str(path))
|
| 112 |
+
for model in model_list:
|
| 113 |
+
private_model_path_repo_dict[model] = repo_id
|
| 114 |
+
return model_list
|
| 115 |
|
| 116 |
|
| 117 |
def get_private_model_lists(repo_id_list, dir_path):
|
|
|
|
| 131 |
if not hf_read_token or newpath.exists(): return
|
| 132 |
filename = file.name
|
| 133 |
dirname = file.parent.name
|
| 134 |
+
try:
|
| 135 |
+
hf_hub_download(repo_id=repo_id, filename=filename, local_dir=dirname, use_auth_token=hf_read_token)
|
| 136 |
+
except (EnvironmentError, OSError, ValueError, HTTPError, Timeout) as e:
|
| 137 |
+
return
|
| 138 |
+
else:
|
| 139 |
+
if is_replace:
|
| 140 |
+
file.rename(newpath)
|
| 141 |
|
| 142 |
|
| 143 |
def download_private_file_from_somewhere(path, is_replace):
|
|
|
|
| 147 |
|
| 148 |
|
| 149 |
def get_model_id_list():
|
|
|
|
| 150 |
api = HfApi()
|
| 151 |
model_ids = []
|
| 152 |
+
try:
|
| 153 |
+
models_vp = api.list_models(author="votepurchase", cardData=True, sort="likes")
|
| 154 |
+
models_john = api.list_models(author="John6666", cardData=True, sort="last_modified")
|
| 155 |
+
except (EnvironmentError, OSError, ValueError, HTTPError, Timeout) as e:
|
| 156 |
+
return model_ids
|
| 157 |
+
else:
|
| 158 |
+
for model in models_vp:
|
| 159 |
+
model_ids.append(model.id) if not model.private else ""
|
| 160 |
+
anime_models = []
|
| 161 |
+
real_models = []
|
| 162 |
+
for model in models_john:
|
| 163 |
+
if not model.private:
|
| 164 |
+
anime_models.append(model.id) if 'anime' in model.tags else real_models.append(model.id)
|
| 165 |
+
model_ids.extend(anime_models)
|
| 166 |
+
model_ids.extend(real_models)
|
| 167 |
+
return model_ids
|
|
|
|
| 168 |
|
| 169 |
|
| 170 |
def get_t2i_model_info(repo_id: str):
|
|
|
|
| 171 |
api = HfApi()
|
| 172 |
+
try:
|
| 173 |
+
if " " in repo_id or not api.repo_exists(repo_id): return ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
model = api.model_info(repo_id=repo_id)
|
| 175 |
+
except (EnvironmentError, OSError, ValueError, HTTPError, Timeout) as e:
|
| 176 |
+
return ""
|
| 177 |
+
else:
|
| 178 |
+
if model.private or model.gated: return ""
|
| 179 |
tags = model.tags
|
| 180 |
info = []
|
| 181 |
+
url = f"https://huggingface.co/{repo_id}/"
|
| 182 |
+
if not 'diffusers' in tags: return ""
|
| 183 |
if 'diffusers:StableDiffusionXLPipeline' in tags:
|
| 184 |
info.append("SDXL")
|
| 185 |
elif 'diffusers:StableDiffusionPipeline' in tags:
|
| 186 |
info.append("SD1.5")
|
| 187 |
if model.card_data and model.card_data.tags:
|
| 188 |
info.extend(list_sub(model.card_data.tags, ['text-to-image', 'stable-diffusion', 'stable-diffusion-api', 'safetensors', 'stable-diffusion-xl']))
|
| 189 |
+
info.append(f"DLs: {model.downloads}")
|
| 190 |
+
info.append(f"likes: {model.likes}")
|
| 191 |
+
info.append(model.last_modified.strftime("lastmod: %Y-%m-%d"))
|
| 192 |
+
md = f"Model Info: {', '.join(info)}, [Model Repo]({url})"
|
| 193 |
+
return gr.update(value=md)
|
| 194 |
|
| 195 |
+
|
| 196 |
+
def get_tupled_model_list(model_list):
|
| 197 |
+
if not model_list: return []
|
| 198 |
+
tupled_list = []
|
| 199 |
+
for repo_id in model_list:
|
| 200 |
+
api = HfApi()
|
| 201 |
+
try:
|
| 202 |
+
if not api.repo_exists(repo_id): continue
|
| 203 |
+
model = api.model_info(repo_id=repo_id)
|
| 204 |
+
except (EnvironmentError, OSError, ValueError, HTTPError, Timeout) as e:
|
| 205 |
+
continue
|
| 206 |
else:
|
| 207 |
+
if model.private or model.gated: continue
|
| 208 |
+
tags = model.tags
|
| 209 |
+
info = []
|
| 210 |
+
if not 'diffusers' in tags: continue
|
| 211 |
+
if 'diffusers:StableDiffusionXLPipeline' in tags:
|
| 212 |
+
info.append("SDXL")
|
| 213 |
+
elif 'diffusers:StableDiffusionPipeline' in tags:
|
| 214 |
+
info.append("SD1.5")
|
| 215 |
+
if model.card_data and model.card_data.tags:
|
| 216 |
+
info.extend(list_sub(model.card_data.tags, ['text-to-image', 'stable-diffusion', 'stable-diffusion-api', 'safetensors', 'stable-diffusion-xl']))
|
| 217 |
+
if "pony" in info:
|
| 218 |
+
info.remove("pony")
|
| 219 |
+
name = f"{repo_id} (Pony🐴, {', '.join(info)})"
|
| 220 |
+
else:
|
| 221 |
+
name = f"{repo_id} ({', '.join(info)})"
|
| 222 |
+
tupled_list.append((name, repo_id))
|
| 223 |
return tupled_list
|
| 224 |
|
| 225 |
|
|
|
|
| 331 |
def get_civitai_info(path):
|
| 332 |
global civitai_not_exists_list
|
| 333 |
import requests
|
| 334 |
+
from urllib3.util import Retry
|
| 335 |
+
from requests.adapters import HTTPAdapter
|
| 336 |
if path in set(civitai_not_exists_list): return ["", "", "", "", ""]
|
| 337 |
from pathlib import Path
|
| 338 |
if not Path(path).exists(): return None
|
|
|
|
| 340 |
headers = {'User-Agent': user_agent, 'content-type': 'application/json'}
|
| 341 |
base_url = 'https://civitai.com/api/v1/model-versions/by-hash/'
|
| 342 |
params = {}
|
| 343 |
+
session = requests.Session()
|
| 344 |
+
retries = Retry(total=5, backoff_factor=1, status_forcelist=[500, 502, 503, 504])
|
| 345 |
+
session.mount("https://", HTTPAdapter(max_retries=retries))
|
| 346 |
import hashlib
|
| 347 |
with open(path, 'rb') as file:
|
| 348 |
file_data = file.read()
|
| 349 |
hash_sha256 = hashlib.sha256(file_data).hexdigest()
|
| 350 |
url = base_url + hash_sha256
|
| 351 |
+
try:
|
| 352 |
+
r = session.get(url, params=params, headers=headers, stream=True, timeout=(3.0, 15))
|
| 353 |
+
except (HTTPError, Timeout) as e:
|
|
|
|
|
|
|
| 354 |
return ["", "", "", "", ""]
|
| 355 |
+
else:
|
| 356 |
+
if not r.ok: return None
|
| 357 |
+
json = r.json()
|
| 358 |
+
if not 'baseModel' in json:
|
| 359 |
+
civitai_not_exists_list.append(path)
|
| 360 |
+
return ["", "", "", "", ""]
|
| 361 |
+
items = []
|
| 362 |
+
items.append(" / ".join(json['trainedWords']))
|
| 363 |
+
items.append(json['baseModel'])
|
| 364 |
+
items.append(json['model']['name'])
|
| 365 |
+
items.append(f"https://civitai.com/models/{json['modelId']}")
|
| 366 |
+
items.append(json['images'][0]['url'])
|
| 367 |
+
return items
|
| 368 |
|
| 369 |
|
| 370 |
def update_lora_dict(path):
|
|
|
|
| 464 |
file_paths = [file.name for file in files]
|
| 465 |
return gr.update(value=file_paths, visible=True)
|
| 466 |
|
| 467 |
+
|
| 468 |
def move_file_lora(filepaths):
|
| 469 |
import shutil
|
| 470 |
from pathlib import Path
|
|
|
|
| 478 |
new_lora_model_list.insert(0, "None")
|
| 479 |
|
| 480 |
return gr.update(
|
| 481 |
+
choices=get_lora_tupled_list(new_lora_model_list), value=new_lora_model_list[-1]
|
| 482 |
), gr.update(
|
| 483 |
choices=get_lora_tupled_list(new_lora_model_list)
|
| 484 |
), gr.update(
|
|
|
|
| 492 |
|
| 493 |
def search_lora_on_civitai(query: str, allow_model: list[str]):
|
| 494 |
import requests
|
| 495 |
+
from urllib3.util import Retry
|
| 496 |
+
from requests.adapters import HTTPAdapter
|
| 497 |
if not query: return None
|
| 498 |
user_agent = get_user_agent()
|
| 499 |
headers = {'User-Agent': user_agent, 'content-type': 'application/json'}
|
| 500 |
base_url = 'https://civitai.com/api/v1/models'
|
| 501 |
params = {'query': query, 'types': ['LORA'], 'sort': 'Highest Rated', 'period': 'AllTime',
|
| 502 |
'nsfw': 'true'}
|
| 503 |
+
session = requests.Session()
|
| 504 |
+
retries = Retry(total=5, backoff_factor=1, status_forcelist=[500, 502, 503, 504])
|
| 505 |
+
session.mount("https://", HTTPAdapter(max_retries=retries))
|
| 506 |
+
try:
|
| 507 |
+
r = session.get(base_url, params=params, headers=headers, stream=True, timeout=(3.0, 30))
|
| 508 |
+
except (HTTPError, Timeout) as e:
|
| 509 |
+
return None
|
| 510 |
+
else:
|
| 511 |
+
if not r.ok: return None
|
| 512 |
+
json = r.json()
|
| 513 |
+
if not 'items' in json: return None
|
| 514 |
+
items = []
|
| 515 |
+
for j in json['items']:
|
| 516 |
+
for model in j['modelVersions']:
|
| 517 |
+
item = {}
|
| 518 |
+
if not model['baseModel'] in set(allow_model): continue
|
| 519 |
+
item['name'] = j['name']
|
| 520 |
+
item['creator'] = j['creator']['username']
|
| 521 |
+
item['tags'] = j['tags']
|
| 522 |
+
item['model_name'] = model['name']
|
| 523 |
+
item['base_model'] = model['baseModel']
|
| 524 |
+
item['dl_url'] = model['downloadUrl']
|
| 525 |
+
item['md'] = f'<img src="{model["images"][0]["url"]}" alt="thumbnail" width="150" height="240"><br>[LoRA Model URL](https://civitai.com/models/{j["id"]})'
|
| 526 |
+
items.append(item)
|
| 527 |
+
return items
|
| 528 |
|
| 529 |
|
| 530 |
civitai_lora_last_results = {}
|
|
|
|
| 538 |
choices = []
|
| 539 |
for item in items:
|
| 540 |
base_model_name = "Pony🐴" if item['base_model'] == "Pony" else item['base_model']
|
| 541 |
+
name = f"{item['name']} (for {base_model_name} / By: {item['creator']} / Tags: {', '.join(item['tags'])})"
|
| 542 |
value = item['dl_url']
|
| 543 |
choices.append((name, value))
|
| 544 |
civitai_lora_last_results[value] = item['md']
|
|
|
|
| 850 |
from huggingface_hub import HfApi
|
| 851 |
api = HfApi()
|
| 852 |
default = "StableDiffusionPipeline"
|
| 853 |
+
try:
|
| 854 |
+
if " " in repo_id or not api.repo_exists(repo_id): return default
|
| 855 |
+
model = api.model_info(repo_id=repo_id)
|
| 856 |
+
except (EnvironmentError, OSError, ValueError, HTTPError, Timeout) as e:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 857 |
return default
|
| 858 |
+
else:
|
| 859 |
+
if model.private or model.gated: return default
|
| 860 |
+
|
| 861 |
+
tags = model.tags
|
| 862 |
+
if not 'diffusers' in tags: return default
|
| 863 |
+
if 'diffusers:StableDiffusionXLPipeline' in tags:
|
| 864 |
+
return "StableDiffusionXLPipeline"
|
| 865 |
+
elif 'diffusers:StableDiffusionPipeline' in tags:
|
| 866 |
+
return "StableDiffusionPipeline"
|
| 867 |
+
else:
|
| 868 |
+
return default
|