model_name
stringclasses 2
values | id_prompt
stringclasses 1
value | frame_prompt
stringclasses 1
value | Image
imagewidth (px) 3.07k
3.07k
| sub_images
listlengths 3
3
| videos
listlengths 15
15
|
|---|---|---|---|---|---|
animagine-xl-3.1
|
A hyper-realistic digital painting of a 16 years old girl.
|
in a flower garden,building a sandcastle,in a city park with autumn leaves
| [{"bytes":"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nOz9+ZMsyXEmCH6qau4eV14v31kHCqgCS(...TRUNCATED)
| [{"motion_bucket_id":10,"video_bytes":"AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAL6httZ(...TRUNCATED)
|
|
GenshinImpact_XL_Base
|
A hyper-realistic digital painting of a 16 years old girl.
|
in a flower garden,building a sandcastle,in a city park with autumn leaves
| [{"bytes":"iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAElEQVR4nOz9abclSXIdim0zc484wx1yqsyauqoHg(...TRUNCATED)
| [{"motion_bucket_id":10,"video_bytes":"AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAJUrptZ(...TRUNCATED)
|
from datasets import Dataset, load_dataset
from PIL import Image
import io
def bytes_to_image(image_bytes):
"""
将字节数据(bytes)转换为 PIL.Image 对象。
"""
image_stream = io.BytesIO(image_bytes)
image = Image.open(image_stream)
return image
# 加载数据集
ds = load_dataset("svjack/OnePromptOneStory-Examples-Vid-head2")["train"]
# 定义 motion_bucket_ids
motion_bucket_ids = [10, 20, 30, 40, 50]
# 创建一个新的数据集列表
new_data = []
# 遍历原始数据集中的每一行
for example in ds:
sub_images = example["sub_images"]
videos = example["videos"]
# 遍历每个 sub_image
for idx, sub_image_dict in enumerate(sub_images):
sub_image_bytes = sub_image_dict["bytes"]
sub_image = bytes_to_image(sub_image_bytes)
# 计算对应的视频索引
video_idx = idx * len(motion_bucket_ids)
# 遍历每个 motion_bucket_id 和对应的视频
for i, motion_bucket_id in enumerate(motion_bucket_ids):
video_dict = videos[video_idx + i]
video_bytes = video_dict["video_bytes"] # 视频的二进制数据
# 创建新的样本,保留原始数据的所有字段
new_sample = {
**example, # 保留原始数据的所有字段
"sub_image": sub_image,
"motion_bucket_id": motion_bucket_id,
"video": video_bytes # 直接存储视频的二进制数据
}
# 添加到新数据集中
new_data.append(new_sample)
# 将新数据转换为 Hugging Face Dataset 对象
new_dataset = Dataset.from_list(new_data)
# 查看新数据集中的第一个样本
#print(new_dataset[0])
new_dataset.push_to_hub("svjack/OnePromptOneStory-Examples-Vid-head2-Exp")
- Downloads last month
- 6