๐ง AI for Content CreationApril 17, 2026โ
Tests passing
Content Batch Creator
This tool automates the creation of multiple pieces of video and image content from a spreadsheet of inputs (e.g., product images, descriptions, themes). It leverages AI models for text-to-image and text-to-video generation, providing a powerful way to scale content production for marketing campaigns or creative projects.
What It Does
- Generate images from text prompts using AI models.
- Generate videos from text prompts with customizable durations.
- Process a CSV file containing multiple prompts and durations to create batches of content.
Installation
The tool requires the following Python packages:
torchtransformerspandasimageio
You can install these dependencies using pip:
pip install torch transformers pandas imageioUsage
Run the tool from the command line with the following arguments:
python content_batch_creator.py --input <path_to_input_csv> --output_folder <path_to_output_folder>Arguments
--input: Path to the input CSV file. The CSV file must contain the following columns:text_prompt: The text prompt for generating content.video_duration: The duration of the generated video in seconds (default is 5 seconds if not provided).--output_folder: Path to the folder where the generated content will be saved.
Example
1. Create an input CSV file named input.csv with the following content:
text_prompt,video_duration
A beautiful sunset,5
A futuristic city,102. Run the tool:
python content_batch_creator.py --input input.csv --output_folder output3. The generated images and videos will be saved in the output folder.
Source Code
import os
import argparse
import pandas as pd
import torch
from transformers import pipeline
import imageio
def generate_image(prompt, output_path):
generator = pipeline("text-to-image", model="CompVis/stable-diffusion-v1-4")
image = generator(prompt)[0]["sample"]
image.save(output_path)
def generate_video(prompt, duration, output_path):
generator = pipeline("text-to-video", model="damo-vilab/text-to-video-ms-1.7b")
frames = generator(prompt, num_frames=int(duration * 10))
with imageio.get_writer(output_path, mode='I', fps=10) as writer:
for frame in frames:
writer.append_data(frame)
def process_csv(input_csv, output_folder):
if not os.path.exists(output_folder):
os.makedirs(output_folder)
try:
df = pd.read_csv(input_csv)
except pd.errors.EmptyDataError:
print("Input CSV is empty. No data to process.")
return
required_columns = {'text_prompt', 'video_duration'}
if not required_columns.issubset(df.columns):
raise KeyError(f"Input CSV must contain the following columns: {required_columns}")
for index, row in df.iterrows():
prompt = row.get('text_prompt', '').strip()
image_path = os.path.join(output_folder, f"image_{index}.png")
video_path = os.path.join(output_folder, f"video_{index}.mp4")
duration = row.get('video_duration', 5) # Default to 5 seconds
if prompt:
generate_image(prompt, image_path)
generate_video(prompt, duration, video_path)
def main():
parser = argparse.ArgumentParser(description="Content Batch Creator")
parser.add_argument('--input', required=True, help="Path to input CSV file")
parser.add_argument('--output_folder', required=True, help="Path to output folder")
args = parser.parse_args()
try:
process_csv(args.input, args.output_folder)
except Exception as e:
print(f"Error occurred: {e}")
if __name__ == "__main__":
main()
Community
Downloads
ยทยทยท
Rate this tool
No ratings yet โ be the first!
Details
- Tool Name
- content_batch_creator
- Category
- AI for Content Creation
- Generated
- April 17, 2026
- Tests
- Passing โ
- Fix Loops
- 2
Quick Install
Clone just this tool:
git clone --depth 1 --filter=blob:none --sparse \ https://github.com/ptulin/autoaiforge.git cd autoaiforge git sparse-checkout set generated_tools/2026-04-17/content_batch_creator cd generated_tools/2026-04-17/content_batch_creator pip install -r requirements.txt 2>/dev/null || true python content_batch_creator.py