Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,14 +70,12 @@ else:
|
|
| 70 |
TITLE = "Multi-Tagger"
|
| 71 |
DESCRIPTION = """
|
| 72 |
Multi-Tagger is a powerful and versatile application that integrates two cutting-edge models: Waifu Diffusion and Florence 2. This app is designed to provide comprehensive image analysis and captioning capabilities, making it a valuable tool for AI artists, researchers, and enthusiasts.
|
| 73 |
-
|
| 74 |
Features:
|
| 75 |
- Supports batch processing of multiple images.
|
| 76 |
- Tags images with multiple categories: general tags, character tags, and ratings.
|
| 77 |
- Displays categorized tags in a structured format.
|
| 78 |
- Includes a separate tab for image captioning using Florence 2. This model supports CUDA, MPS or CPU if one of them is available.
|
| 79 |
- Supports various captioning tasks (e.g., Caption, Detailed Caption, Object Detection), as well it can display output text and images for tasks that generate visual outputs.
|
| 80 |
-
|
| 81 |
Example image by [me.](https://huggingface.co/Werli)
|
| 82 |
"""
|
| 83 |
colormap = ['blue','orange','green','purple','brown','pink','gray','olive','cyan','red',
|
|
@@ -215,7 +213,6 @@ class Llama3Reorganize:
|
|
| 215 |
loadModel: bool = False,
|
| 216 |
):
|
| 217 |
"""Initializes the Llama model.
|
| 218 |
-
|
| 219 |
Args:
|
| 220 |
repoId: LLAMA model repo.
|
| 221 |
device: Device to use for computation (cpu, cuda, ipu, xpu, mkldnn, opengl, opencl,
|
|
@@ -1023,6 +1020,7 @@ with gr.Blocks(title=TITLE, css=css, theme="Werli/Multi-Tagger", fill_width=True
|
|
| 1023 |
[
|
| 1024 |
download_file,
|
| 1025 |
sorted_general_strings,
|
|
|
|
| 1026 |
categorized,
|
| 1027 |
rating,
|
| 1028 |
character_res,
|
|
@@ -1037,7 +1035,7 @@ with gr.Blocks(title=TITLE, css=css, theme="Werli/Multi-Tagger", fill_width=True
|
|
| 1037 |
upload_button.upload(extend_gallery, inputs=[gallery, upload_button], outputs=gallery)
|
| 1038 |
# Event to update the selected image when an image is clicked in the gallery
|
| 1039 |
selected_image = gr.Textbox(label="Selected Image", visible=False)
|
| 1040 |
-
gallery.select(get_selection_from_gallery, inputs=[gallery, tag_results], outputs=[selected_image, sorted_general_strings, categorized, rating, character_res, general_res, unclassified])
|
| 1041 |
# Event to remove a selected image from the gallery
|
| 1042 |
remove_button.click(remove_image_from_gallery, inputs=[gallery, selected_image], outputs=gallery)
|
| 1043 |
submit.click(
|
|
@@ -1055,7 +1053,7 @@ with gr.Blocks(title=TITLE, css=css, theme="Werli/Multi-Tagger", fill_width=True
|
|
| 1055 |
additional_tags_append,
|
| 1056 |
tag_results,
|
| 1057 |
],
|
| 1058 |
-
outputs=[download_file, sorted_general_strings, categorized, rating, character_res, general_res, unclassified, tag_results, categorized_output,],
|
| 1059 |
)
|
| 1060 |
gr.Examples(
|
| 1061 |
[["images/1girl.png", VIT_LARGE_MODEL_DSV3_REPO, 0.35, False, 0.85, False]],
|
|
|
|
| 70 |
TITLE = "Multi-Tagger"
|
| 71 |
DESCRIPTION = """
|
| 72 |
Multi-Tagger is a powerful and versatile application that integrates two cutting-edge models: Waifu Diffusion and Florence 2. This app is designed to provide comprehensive image analysis and captioning capabilities, making it a valuable tool for AI artists, researchers, and enthusiasts.
|
|
|
|
| 73 |
Features:
|
| 74 |
- Supports batch processing of multiple images.
|
| 75 |
- Tags images with multiple categories: general tags, character tags, and ratings.
|
| 76 |
- Displays categorized tags in a structured format.
|
| 77 |
- Includes a separate tab for image captioning using Florence 2. This model supports CUDA, MPS or CPU if one of them is available.
|
| 78 |
- Supports various captioning tasks (e.g., Caption, Detailed Caption, Object Detection), as well it can display output text and images for tasks that generate visual outputs.
|
|
|
|
| 79 |
Example image by [me.](https://huggingface.co/Werli)
|
| 80 |
"""
|
| 81 |
colormap = ['blue','orange','green','purple','brown','pink','gray','olive','cyan','red',
|
|
|
|
| 213 |
loadModel: bool = False,
|
| 214 |
):
|
| 215 |
"""Initializes the Llama model.
|
|
|
|
| 216 |
Args:
|
| 217 |
repoId: LLAMA model repo.
|
| 218 |
device: Device to use for computation (cpu, cuda, ipu, xpu, mkldnn, opengl, opencl,
|
|
|
|
| 1020 |
[
|
| 1021 |
download_file,
|
| 1022 |
sorted_general_strings,
|
| 1023 |
+
categorized_output,
|
| 1024 |
categorized,
|
| 1025 |
rating,
|
| 1026 |
character_res,
|
|
|
|
| 1035 |
upload_button.upload(extend_gallery, inputs=[gallery, upload_button], outputs=gallery)
|
| 1036 |
# Event to update the selected image when an image is clicked in the gallery
|
| 1037 |
selected_image = gr.Textbox(label="Selected Image", visible=False)
|
| 1038 |
+
gallery.select(get_selection_from_gallery, inputs=[gallery, tag_results], outputs=[selected_image, sorted_general_strings, categorized, categorized_output, rating, character_res, general_res, unclassified])
|
| 1039 |
# Event to remove a selected image from the gallery
|
| 1040 |
remove_button.click(remove_image_from_gallery, inputs=[gallery, selected_image], outputs=gallery)
|
| 1041 |
submit.click(
|
|
|
|
| 1053 |
additional_tags_append,
|
| 1054 |
tag_results,
|
| 1055 |
],
|
| 1056 |
+
outputs=[download_file, sorted_general_strings, categorized, categorized_output, rating, character_res, general_res, unclassified, tag_results, categorized_output,],
|
| 1057 |
)
|
| 1058 |
gr.Examples(
|
| 1059 |
[["images/1girl.png", VIT_LARGE_MODEL_DSV3_REPO, 0.35, False, 0.85, False]],
|