Datasets:
Update diffusiondb-pixelart.py
Browse files- diffusiondb-pixelart.py +50 -50
diffusiondb-pixelart.py
CHANGED
|
@@ -158,18 +158,18 @@ class DiffusionDB(datasets.GeneratorBasedBuilder):
|
|
| 158 |
features = datasets.Features(
|
| 159 |
{
|
| 160 |
"image_name": datasets.Value("string"),
|
| 161 |
-
"
|
| 162 |
-
"part_id": datasets.Value("uint16"),
|
| 163 |
-
"seed": datasets.Value("uint32"),
|
| 164 |
-
"step": datasets.Value("uint16"),
|
| 165 |
-
"cfg": datasets.Value("float32"),
|
| 166 |
-
"sampler": datasets.Value("string"),
|
| 167 |
-
"width": datasets.Value("uint16"),
|
| 168 |
-
"height": datasets.Value("uint16"),
|
| 169 |
-
"user_name": datasets.Value("string"),
|
| 170 |
-
"timestamp": datasets.Value("timestamp[us, tz=UTC]"),
|
| 171 |
-
"image_nsfw": datasets.Value("float32"),
|
| 172 |
-
"prompt_nsfw": datasets.Value("float32"),
|
| 173 |
},
|
| 174 |
)
|
| 175 |
|
|
@@ -177,17 +177,17 @@ class DiffusionDB(datasets.GeneratorBasedBuilder):
|
|
| 177 |
features = datasets.Features(
|
| 178 |
{
|
| 179 |
"image": datasets.Image(),
|
| 180 |
-
"
|
| 181 |
-
"seed": datasets.Value("uint32"),
|
| 182 |
-
"step": datasets.Value("uint16"),
|
| 183 |
-
"cfg": datasets.Value("float32"),
|
| 184 |
-
"sampler": datasets.Value("string"),
|
| 185 |
-
"width": datasets.Value("uint16"),
|
| 186 |
-
"height": datasets.Value("uint16"),
|
| 187 |
-
"user_name": datasets.Value("string"),
|
| 188 |
-
"timestamp": datasets.Value("timestamp[us, tz=UTC]"),
|
| 189 |
-
"image_nsfw": datasets.Value("float32"),
|
| 190 |
-
"prompt_nsfw": datasets.Value("float32"),
|
| 191 |
},
|
| 192 |
)
|
| 193 |
|
|
@@ -252,20 +252,20 @@ class DiffusionDB(datasets.GeneratorBasedBuilder):
|
|
| 252 |
for _, row in metadata_df.iterrows():
|
| 253 |
yield row["image_name"], {
|
| 254 |
"image_name": row["image_name"],
|
| 255 |
-
"
|
| 256 |
-
"part_id": row["part_id"],
|
| 257 |
-
"seed": row["seed"],
|
| 258 |
-
"step": row["step"],
|
| 259 |
-
"cfg": row["cfg"],
|
| 260 |
-
"sampler": _SAMPLER_DICT[int(row["sampler"])],
|
| 261 |
-
"width": row["width"],
|
| 262 |
-
"height": row["height"],
|
| 263 |
-
"user_name": row["user_name"],
|
| 264 |
-
"timestamp": None
|
| 265 |
-
if pd.isnull(row["timestamp"])
|
| 266 |
-
else row["timestamp"],
|
| 267 |
-
"image_nsfw": row["image_nsfw"],
|
| 268 |
-
"prompt_nsfw": row["prompt_nsfw"],
|
| 269 |
}
|
| 270 |
|
| 271 |
else:
|
|
@@ -308,17 +308,17 @@ class DiffusionDB(datasets.GeneratorBasedBuilder):
|
|
| 308 |
"path": img_path,
|
| 309 |
"bytes": open(img_path, "rb").read(),
|
| 310 |
},
|
| 311 |
-
"
|
| 312 |
-
"seed": int(img_params["se"]),
|
| 313 |
-
"step": int(img_params["st"]),
|
| 314 |
-
"cfg": float(img_params["c"]),
|
| 315 |
-
"sampler": img_params["sa"],
|
| 316 |
-
"width": query_result["width"].to_list()[0],
|
| 317 |
-
"height": query_result["height"].to_list()[0],
|
| 318 |
-
"user_name": query_result["user_name"].to_list()[0],
|
| 319 |
-
"timestamp": None
|
| 320 |
-
if pd.isnull(query_result["timestamp"].to_list()[0])
|
| 321 |
-
else query_result["timestamp"].to_list()[0],
|
| 322 |
-
"image_nsfw": query_result["image_nsfw"].to_list()[0],
|
| 323 |
-
"prompt_nsfw": query_result["prompt_nsfw"].to_list()[0],
|
| 324 |
}
|
|
|
|
| 158 |
features = datasets.Features(
|
| 159 |
{
|
| 160 |
"image_name": datasets.Value("string"),
|
| 161 |
+
"text": datasets.Value("string"),
|
| 162 |
+
#"part_id": datasets.Value("uint16"),
|
| 163 |
+
#"seed": datasets.Value("uint32"),
|
| 164 |
+
#"step": datasets.Value("uint16"),
|
| 165 |
+
#"cfg": datasets.Value("float32"),
|
| 166 |
+
#"sampler": datasets.Value("string"),
|
| 167 |
+
#"width": datasets.Value("uint16"),
|
| 168 |
+
#"height": datasets.Value("uint16"),
|
| 169 |
+
#"user_name": datasets.Value("string"),
|
| 170 |
+
#"timestamp": datasets.Value("timestamp[us, tz=UTC]"),
|
| 171 |
+
#"image_nsfw": datasets.Value("float32"),
|
| 172 |
+
#"prompt_nsfw": datasets.Value("float32"),
|
| 173 |
},
|
| 174 |
)
|
| 175 |
|
|
|
|
| 177 |
features = datasets.Features(
|
| 178 |
{
|
| 179 |
"image": datasets.Image(),
|
| 180 |
+
"text": datasets.Value("string"),
|
| 181 |
+
#"seed": datasets.Value("uint32"),
|
| 182 |
+
#"step": datasets.Value("uint16"),
|
| 183 |
+
#"cfg": datasets.Value("float32"),
|
| 184 |
+
#"sampler": datasets.Value("string"),
|
| 185 |
+
#"width": datasets.Value("uint16"),
|
| 186 |
+
#"height": datasets.Value("uint16"),
|
| 187 |
+
#"user_name": datasets.Value("string"),
|
| 188 |
+
#"timestamp": datasets.Value("timestamp[us, tz=UTC]"),
|
| 189 |
+
#"image_nsfw": datasets.Value("float32"),
|
| 190 |
+
#"prompt_nsfw": datasets.Value("float32"),
|
| 191 |
},
|
| 192 |
)
|
| 193 |
|
|
|
|
| 252 |
for _, row in metadata_df.iterrows():
|
| 253 |
yield row["image_name"], {
|
| 254 |
"image_name": row["image_name"],
|
| 255 |
+
"text": row["prompt"],
|
| 256 |
+
#"part_id": row["part_id"],
|
| 257 |
+
#"seed": row["seed"],
|
| 258 |
+
#"step": row["step"],
|
| 259 |
+
#"cfg": row["cfg"],
|
| 260 |
+
#"sampler": _SAMPLER_DICT[int(row["sampler"])],
|
| 261 |
+
#"width": row["width"],
|
| 262 |
+
#"height": row["height"],
|
| 263 |
+
#"user_name": row["user_name"],
|
| 264 |
+
#"timestamp": None
|
| 265 |
+
#if pd.isnull(row["timestamp"])
|
| 266 |
+
#else row["timestamp"],
|
| 267 |
+
#"image_nsfw": row["image_nsfw"],
|
| 268 |
+
#"prompt_nsfw": row["prompt_nsfw"],
|
| 269 |
}
|
| 270 |
|
| 271 |
else:
|
|
|
|
| 308 |
"path": img_path,
|
| 309 |
"bytes": open(img_path, "rb").read(),
|
| 310 |
},
|
| 311 |
+
"text": img_params["p"],
|
| 312 |
+
#"seed": int(img_params["se"]),
|
| 313 |
+
#"step": int(img_params["st"]),
|
| 314 |
+
#"cfg": float(img_params["c"]),
|
| 315 |
+
#"sampler": img_params["sa"],
|
| 316 |
+
#"width": query_result["width"].to_list()[0],
|
| 317 |
+
#"height": query_result["height"].to_list()[0],
|
| 318 |
+
#"user_name": query_result["user_name"].to_list()[0],
|
| 319 |
+
#"timestamp": None
|
| 320 |
+
#if pd.isnull(query_result["timestamp"].to_list()[0])
|
| 321 |
+
#else query_result["timestamp"].to_list()[0],
|
| 322 |
+
#"image_nsfw": query_result["image_nsfw"].to_list()[0],
|
| 323 |
+
#"prompt_nsfw": query_result["prompt_nsfw"].to_list()[0],
|
| 324 |
}
|