update every stupid script
Browse files- debug_emoji +3 -0
- dolphinvision +1 -1
- extract_description +1 -1
- get_maskgct.py → get_maskgct +3 -0
- img_remove_white_border +1 -0
- maskgct.py +3 -0
- ocr +1 -1
- pick_caption +1 -1
- remove_boys +1 -1
- select_and_concat_captions +3 -1
- shortcode +2 -0
- stats +2 -1
- tags2txt_safe +2 -1
- txt2emoji +3 -0
- txt2tags +1 -1
- write_dataset_cfg_combined.py → write_dataset_cfg_combined +1 -0
- xyplot +114 -0
- yiffdata +1 -1
- zsh/gallery-dl.zsh +2 -0
- zsh/git-wrapper.zsh +2 -0
- ogg2wav → zsh/ogg2wav.zsh +2 -0
- zsh/train_functions.zsh +2 -0
debug_emoji
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
import emoji
|
2 |
|
3 |
def print_all_emojis():
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
|
4 |
import emoji
|
5 |
|
6 |
def print_all_emojis():
|
dolphinvision
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#!/usr/bin/env python
|
2 |
-
|
3 |
import torch
|
4 |
import transformers
|
5 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
1 |
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
import torch
|
4 |
import transformers
|
5 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
extract_description
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#!/usr/bin/env python
|
2 |
-
|
3 |
"""
|
4 |
JSON Caption Extractor
|
5 |
|
|
|
1 |
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
"""
|
4 |
JSON Caption Extractor
|
5 |
|
get_maskgct.py → get_maskgct
RENAMED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
from huggingface_hub import hf_hub_download
|
2 |
|
3 |
# download semantic codec ckpt
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
|
4 |
from huggingface_hub import hf_hub_download
|
5 |
|
6 |
# download semantic codec ckpt
|
img_remove_white_border
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
#!/usr/bin/env python
|
|
|
2 |
|
3 |
import cv2
|
4 |
import numpy as np
|
|
|
1 |
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
|
4 |
import cv2
|
5 |
import numpy as np
|
maskgct.py
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
from huggingface_hub import hf_hub_download
|
2 |
import torch
|
3 |
import safetensors
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
|
4 |
from huggingface_hub import hf_hub_download
|
5 |
import torch
|
6 |
import safetensors
|
ocr
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#!/usr/bin/env python
|
2 |
-
|
3 |
from transformers import AutoModel, AutoTokenizer
|
4 |
|
5 |
tokenizer = AutoTokenizer.from_pretrained('ucaslcl/GOT-OCR2_0', trust_remote_code=True)
|
|
|
1 |
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
from transformers import AutoModel, AutoTokenizer
|
4 |
|
5 |
tokenizer = AutoTokenizer.from_pretrained('ucaslcl/GOT-OCR2_0', trust_remote_code=True)
|
pick_caption
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#!/usr/bin/env python
|
2 |
-
|
3 |
import os
|
4 |
import re
|
5 |
|
|
|
1 |
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
import os
|
4 |
import re
|
5 |
|
remove_boys
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#!/usr/bin/env python
|
2 |
-
|
3 |
import os
|
4 |
import re
|
5 |
import sys
|
|
|
1 |
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
import os
|
4 |
import re
|
5 |
import sys
|
select_and_concat_captions
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
-
#!/usr/bin/env
|
|
|
|
|
2 |
"""
|
3 |
This script walks through a directory, identifies image files, and checks for the existence of corresponding
|
4 |
.caption and .tags files. It then concatenates the contents of .caption and .tags files into the .txt files.
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
|
4 |
"""
|
5 |
This script walks through a directory, identifies image files, and checks for the existence of corresponding
|
6 |
.caption and .tags files. It then concatenates the contents of .caption and .tags files into the .txt files.
|
shortcode
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
#!/usr/bin/env python
|
|
|
|
|
2 |
import os
|
3 |
import json
|
4 |
|
|
|
1 |
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
|
4 |
import os
|
5 |
import json
|
6 |
|
stats
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
#!/usr/bin/env
|
|
|
2 |
|
3 |
import os
|
4 |
import sys
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
|
4 |
import os
|
5 |
import sys
|
tags2txt_safe
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
#!/usr/bin/env
|
|
|
2 |
|
3 |
"""
|
4 |
This script walks through a directory and copies .tags files to .txt files, but only
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
|
4 |
"""
|
5 |
This script walks through a directory and copies .tags files to .txt files, but only
|
txt2emoji
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
import nltk
|
2 |
from nltk.tokenize import word_tokenize
|
3 |
from emoji import EMOJI_DATA
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
|
4 |
import nltk
|
5 |
from nltk.tokenize import word_tokenize
|
6 |
from emoji import EMOJI_DATA
|
txt2tags
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#!/usr/bin/env python
|
2 |
-
|
3 |
import os
|
4 |
from pathlib import Path
|
5 |
|
|
|
1 |
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
import os
|
4 |
from pathlib import Path
|
5 |
|
write_dataset_cfg_combined.py → write_dataset_cfg_combined
RENAMED
@@ -1,4 +1,5 @@
|
|
1 |
#!/bin/env python
|
|
|
2 |
|
3 |
import os
|
4 |
import toml
|
|
|
1 |
#!/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
|
4 |
import os
|
5 |
import toml
|
xyplot
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
|
4 |
+
# Import necessary libraries
|
5 |
+
import cv2
|
6 |
+
import argparse
|
7 |
+
import numpy as np
|
8 |
+
|
9 |
+
# Parse command line arguments
|
10 |
+
parser = argparse.ArgumentParser(description='Display images with optional labels.')
|
11 |
+
parser.add_argument('images', nargs='+', help='List of image file paths')
|
12 |
+
parser.add_argument('--labels', nargs='+', default=[], help='List of optional labels for each image')
|
13 |
+
parser.add_argument('--output', default='output.jpg', help='Output file name for the generated plot')
|
14 |
+
parser.add_argument('--rows', type=int, default=1, help='Number of rows to display the images')
|
15 |
+
parser.add_argument('--row-labels', nargs='+', default=[], help='List of optional labels for each row')
|
16 |
+
parser.add_argument('--column-labels', nargs='+', default=[], help='List of optional labels for each column')
|
17 |
+
|
18 |
+
args = parser.parse_args()
|
19 |
+
|
20 |
+
# Function to save images with optional labels as a plot with a white section on top
|
21 |
+
def save_image_plot(images, labels=None, output='output.jpg', rows=1, row_labels=None, column_labels=None):
|
22 |
+
if not labels:
|
23 |
+
labels = [''] * len(images)
|
24 |
+
|
25 |
+
if not row_labels:
|
26 |
+
row_labels = [''] * rows
|
27 |
+
|
28 |
+
if not column_labels:
|
29 |
+
column_labels = [''] * ((len(images) + rows - 1) // rows)
|
30 |
+
|
31 |
+
# Validate the number of labels matches the number of images
|
32 |
+
if len(labels) != len(images):
|
33 |
+
print("Error: Number of labels should match the number of images.")
|
34 |
+
return
|
35 |
+
|
36 |
+
# Validate the number of row labels matches the number of rows
|
37 |
+
if len(row_labels) != rows:
|
38 |
+
print("Error: Number of row labels should match the number of rows.")
|
39 |
+
return
|
40 |
+
|
41 |
+
# Validate the number of column labels matches the number of columns
|
42 |
+
cols = (len(images) + rows - 1) // rows
|
43 |
+
if len(column_labels) != cols:
|
44 |
+
print("Error: Number of column labels should match the number of columns.")
|
45 |
+
return
|
46 |
+
|
47 |
+
# Read the first image to determine dimensions
|
48 |
+
first_image = cv2.imread(images[0])
|
49 |
+
|
50 |
+
# Define canvas dimensions
|
51 |
+
image_height = first_image.shape[0]
|
52 |
+
image_width = first_image.shape[1]
|
53 |
+
|
54 |
+
# Only add top_padding if we have labels other than column_labels
|
55 |
+
has_other_labels = bool(labels and any(labels)) or bool(row_labels and any(row_labels))
|
56 |
+
#top_padding = 80 if has_other_labels else (80 if row_labels else 80)
|
57 |
+
top_padding = 50
|
58 |
+
|
59 |
+
# Adjust canvas height to remove padding between rows when only column labels are present
|
60 |
+
if not has_other_labels and column_labels:
|
61 |
+
canvas_height = image_height * rows + top_padding # Only add padding at the top
|
62 |
+
else:
|
63 |
+
canvas_height = (image_height + top_padding) * rows
|
64 |
+
|
65 |
+
canvas_width = image_width * cols
|
66 |
+
|
67 |
+
# Add extra width for row labels if they are provided
|
68 |
+
left_padding = 40 if any(label.strip() for label in row_labels) else 0
|
69 |
+
canvas_width += left_padding
|
70 |
+
|
71 |
+
canvas = np.ones((canvas_height, canvas_width, 3), dtype=np.uint8) * 255
|
72 |
+
|
73 |
+
# Add column labels (seed labels) at the top
|
74 |
+
for i, label in enumerate(column_labels):
|
75 |
+
x_pos = i * image_width + left_padding
|
76 |
+
cv2.putText(canvas, label, (x_pos, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 2, cv2.LINE_AA)
|
77 |
+
|
78 |
+
# Iterate through images and labels
|
79 |
+
for i, img_path in enumerate(images):
|
80 |
+
image = cv2.imread(img_path)
|
81 |
+
|
82 |
+
# Calculate the row and column indices for the current image
|
83 |
+
row = i // cols
|
84 |
+
col = i % cols
|
85 |
+
|
86 |
+
# Add row label on the left side if provided
|
87 |
+
if row_labels[row].strip():
|
88 |
+
cv2.putText(canvas, row_labels[row], (0, row * (image_height + top_padding) + 60), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 2, cv2.LINE_AA)
|
89 |
+
|
90 |
+
# Add seed label centered on the image
|
91 |
+
seed_label = column_labels[col]
|
92 |
+
(text_width, text_height), _ = cv2.getTextSize(seed_label, cv2.FONT_HERSHEY_SIMPLEX, 1, 2)
|
93 |
+
x_seed = col * image_width + left_padding + (image_width - text_width) // 2
|
94 |
+
y_seed = row * (image_height + top_padding) + top_padding + (image_height - text_height) // 2
|
95 |
+
cv2.putText(canvas, seed_label, (x_seed, y_seed), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 0), 2, cv2.LINE_AA)
|
96 |
+
|
97 |
+
# Adjust y_start calculation to remove padding between rows when only column labels are present
|
98 |
+
if not has_other_labels and column_labels:
|
99 |
+
y_start = row * image_height + top_padding
|
100 |
+
y_end = y_start + image_height
|
101 |
+
else:
|
102 |
+
y_start = row * (image_height + top_padding) + top_padding
|
103 |
+
y_end = y_start + image_height
|
104 |
+
|
105 |
+
x_start = col * image_width + left_padding
|
106 |
+
x_end = x_start + image_width
|
107 |
+
canvas[y_start:y_end, x_start:x_end, :] = image
|
108 |
+
|
109 |
+
# Save the generated plot
|
110 |
+
cv2.imwrite(output, canvas)
|
111 |
+
print(f"Generated plot saved as {output}")
|
112 |
+
|
113 |
+
# Execute the function with command line arguments
|
114 |
+
save_image_plot(args.images, args.labels, args.output, args.rows, args.row_labels, args.column_labels)
|
yiffdata
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#!/usr/bin/env python
|
2 |
-
|
3 |
import os
|
4 |
import json
|
5 |
from PIL import Image
|
|
|
1 |
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
import os
|
4 |
import json
|
5 |
from PIL import Image
|
zsh/gallery-dl.zsh
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
# Override the gallery-dl command to change the directory to ~/datasets
|
2 |
# before executing the original command
|
3 |
function gallery-dl() {
|
|
|
1 |
+
#!/bin/zsh
|
2 |
+
|
3 |
# Override the gallery-dl command to change the directory to ~/datasets
|
4 |
# before executing the original command
|
5 |
function gallery-dl() {
|
zsh/git-wrapper.zsh
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
# This function is a wrapper for the 'git' command, providing additional functionality for the 'clone' and 'add' operations.
|
2 |
#
|
3 |
# Usage:
|
|
|
1 |
+
#!/bin/zsh
|
2 |
+
|
3 |
# This function is a wrapper for the 'git' command, providing additional functionality for the 'clone' and 'add' operations.
|
4 |
#
|
5 |
# Usage:
|
ogg2wav → zsh/ogg2wav.zsh
RENAMED
@@ -1,5 +1,7 @@
|
|
1 |
#!/bin/zsh
|
2 |
|
|
|
|
|
3 |
# Function to convert ogg to wav
|
4 |
convert_ogg_to_wav() {
|
5 |
local input_file="$1"
|
|
|
1 |
#!/bin/zsh
|
2 |
|
3 |
+
# TODO: Wrap this in a function
|
4 |
+
|
5 |
# Function to convert ogg to wav
|
6 |
convert_ogg_to_wav() {
|
7 |
local input_file="$1"
|
zsh/train_functions.zsh
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
# Functions for sd-scripts training scripts
|
2 |
|
3 |
# Executes a training script located at the specified path with the provided arguments.
|
|
|
1 |
+
#!/bin/zsh
|
2 |
+
|
3 |
# Functions for sd-scripts training scripts
|
4 |
|
5 |
# Executes a training script located at the specified path with the provided arguments.
|