Spaces:
Running
on
Zero
Running
on
Zero
Upload 2 files
Browse files- app.py +3 -6
- fl2sd3longcap.py +2 -4
app.py
CHANGED
@@ -180,10 +180,7 @@ download_vae_list = [
|
|
180 |
]
|
181 |
download_vae = ", ".join(download_vae_list)
|
182 |
# - **Download LoRAs**
|
183 |
-
download_lora_list = [
|
184 |
-
'https://huggingface.co/John6666/loratest/resolve/main/Kenmokun_XL_1.1.safetensors?download=true',
|
185 |
-
'https://huggingface.co/John6666/loratest/resolve/main/NanJmin_XL_1.0.safetensors?download=true',
|
186 |
-
]
|
187 |
download_lora = ", ".join(download_lora_list)
|
188 |
|
189 |
def download_private_repo(repo_id, dir_path):
|
@@ -865,7 +862,7 @@ with gr.Blocks(theme="NoCrypt/miku", elem_id="main", css=CSS) as app:
|
|
865 |
tag_type_gui = gr.Radio(label="Convert tags to", info="danbooru for Animagine, e621 for Pony.", choices=["danbooru", "e621"], value="danbooru")
|
866 |
recom_prompt_gui = gr.Radio(label="Insert reccomended prompt", choices=["None", "Animagine", "Pony"], value="None", interactive=True)
|
867 |
keep_tags_gui = gr.Radio(label="Remove tags leaving only the following", choices=["body", "dress", "all"], value="all")
|
868 |
-
image_algorithms = gr.CheckboxGroup(["Use WD Tagger", "Use Florence-2-SD3-Long-Captioner"], label="Algorithms", value=["Use WD Tagger"], visible=
|
869 |
generate_from_image_btn_gui = gr.Button(value="GENERATE TAGS FROM IMAGE", size="lg", variant="primary")
|
870 |
with gr.Group():
|
871 |
prompt_gui = gr.Textbox(lines=6, placeholder="1girl, solo, ...", label="Prompt", show_copy_button=True)
|
@@ -1691,7 +1688,7 @@ with gr.Blocks(theme="NoCrypt/miku", elem_id="main", css=CSS) as app:
|
|
1691 |
character_threshold = gr.Slider(label="Character threshold", minimum=0.0, maximum=1.0, value=0.8, step=0.01, interactive=True)
|
1692 |
input_tag_type = gr.Radio(label="Convert tags to", info="danbooru for Animagine, e621 for Pony.", choices=["danbooru", "e621"], value="danbooru")
|
1693 |
recom_prompt = gr.Radio(label="Insert reccomended prompt", choices=["None", "Animagine", "Pony"], value="None", interactive=True)
|
1694 |
-
image_algorithms = gr.CheckboxGroup(["Use WD Tagger", "Use Florence-2-SD3-Long-Captioner"], label="Algorithms", value=["Use WD Tagger"], visible=
|
1695 |
keep_tags = gr.Radio(label="Remove tags leaving only the following", choices=["body", "dress", "all"], value="all")
|
1696 |
generate_from_image_btn = gr.Button(value="GENERATE TAGS FROM IMAGE", size="lg", variant="primary")
|
1697 |
|
|
|
180 |
]
|
181 |
download_vae = ", ".join(download_vae_list)
|
182 |
# - **Download LoRAs**
|
183 |
+
download_lora_list = []
|
|
|
|
|
|
|
184 |
download_lora = ", ".join(download_lora_list)
|
185 |
|
186 |
def download_private_repo(repo_id, dir_path):
|
|
|
862 |
tag_type_gui = gr.Radio(label="Convert tags to", info="danbooru for Animagine, e621 for Pony.", choices=["danbooru", "e621"], value="danbooru")
|
863 |
recom_prompt_gui = gr.Radio(label="Insert reccomended prompt", choices=["None", "Animagine", "Pony"], value="None", interactive=True)
|
864 |
keep_tags_gui = gr.Radio(label="Remove tags leaving only the following", choices=["body", "dress", "all"], value="all")
|
865 |
+
image_algorithms = gr.CheckboxGroup(["Use WD Tagger", "Use Florence-2-SD3-Long-Captioner"], label="Algorithms", value=["Use WD Tagger"], visible=True)
|
866 |
generate_from_image_btn_gui = gr.Button(value="GENERATE TAGS FROM IMAGE", size="lg", variant="primary")
|
867 |
with gr.Group():
|
868 |
prompt_gui = gr.Textbox(lines=6, placeholder="1girl, solo, ...", label="Prompt", show_copy_button=True)
|
|
|
1688 |
character_threshold = gr.Slider(label="Character threshold", minimum=0.0, maximum=1.0, value=0.8, step=0.01, interactive=True)
|
1689 |
input_tag_type = gr.Radio(label="Convert tags to", info="danbooru for Animagine, e621 for Pony.", choices=["danbooru", "e621"], value="danbooru")
|
1690 |
recom_prompt = gr.Radio(label="Insert reccomended prompt", choices=["None", "Animagine", "Pony"], value="None", interactive=True)
|
1691 |
+
image_algorithms = gr.CheckboxGroup(["Use WD Tagger", "Use Florence-2-SD3-Long-Captioner"], label="Algorithms", value=["Use WD Tagger"], visible=True)
|
1692 |
keep_tags = gr.Radio(label="Remove tags leaving only the following", choices=["body", "dress", "all"], value="all")
|
1693 |
generate_from_image_btn = gr.Button(value="GENERATE TAGS FROM IMAGE", size="lg", variant="primary")
|
1694 |
|
fl2sd3longcap.py
CHANGED
@@ -2,14 +2,12 @@ from transformers import AutoProcessor, AutoModelForCausalLM
|
|
2 |
import spaces
|
3 |
import re
|
4 |
from PIL import Image
|
5 |
-
import torch
|
6 |
|
7 |
import subprocess
|
8 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
fl_processor = AutoProcessor.from_pretrained('gokaygokay/Florence-2-SD3-Captioner', torch_dtype=torch.float16, attn_implementation="flash_attention_2", trust_remote_code=True)
|
13 |
|
14 |
|
15 |
def fl_modify_caption(caption: str) -> str:
|
|
|
2 |
import spaces
|
3 |
import re
|
4 |
from PIL import Image
|
|
|
5 |
|
6 |
import subprocess
|
7 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
8 |
|
9 |
+
fl_model = AutoModelForCausalLM.from_pretrained('gokaygokay/Florence-2-SD3-Captioner', trust_remote_code=True).to("cuda").eval()
|
10 |
+
fl_processor = AutoProcessor.from_pretrained('gokaygokay/Florence-2-SD3-Captioner', trust_remote_code=True)
|
|
|
11 |
|
12 |
|
13 |
def fl_modify_caption(caption: str) -> str:
|