๐ป Code Cells (Copy-Paste)
Cell 1: Install & Load Model
# Cell 1: Install dependencies
!pip install -q diffusers transformers accelerate sentencepiece imageio[ffmpeg]
import torch
from diffusers import CogVideoXPipeline
# Load CogVideoX-5B
pipe = CogVideoXPipeline.from_pretrained(
"THUDM/CogVideoX-5B",
torch_dtype=torch.float16,
)
pipe.to("cuda")
print("โ
Model loaded!")
Cell 2: Generate Function
# Cell 2: Generate video function
def generate_video(prompt, output_path="output.mp4"):
print(f"๐ฌ Generating: {prompt[:50]}...")
video = pipe(
prompt=prompt,
num_frames=49, # ~6 seconds
num_inference_steps=50,
guidance_scale=6.0,
).frames[0]
import imageio
imageio.mimwrite(output_path, video, fps=24)
print(f"โ
Saved: {output_path}")
return output_path
Cell 3: Test Prompts
# Cell 3: Generate test videos
import os
os.makedirs("output", exist_ok=True)
# Prompt 1: Masjid Nabawi
prompt_1 = """
A beautiful aerial view of Masjid Nabawi in Medina during golden hour sunset.
The green dome is visible in the center, surrounded by white minarets.
Pilgrims in white ihram clothing are walking around the courtyard.
Warm golden light bathes the entire scene. Cinematic photography style,
smooth camera movement, peaceful and spiritual atmosphere.
"""
# Prompt 2: Kaaba
prompt_2 = """
Holy Kaaba in Mecca surrounded by hundreds of pilgrims performing tawaf.
Aerial view showing the circular movement of people around the Kaaba.
Dramatic sky with golden clouds at sunset. Spiritual atmosphere,
cinematic wide angle shot, smooth camera pan.
"""
# Prompt 3: Turkish Mosque
prompt_3 = """
Interior of a beautiful Ottoman mosque in Istanbul, Turkey.
Sunlight streaming through stained glass windows creating colorful light patterns.
Ornate Islamic calligraphy on the walls, grand chandeliers hanging from the ceiling.
Peaceful atmosphere, cinematic slow camera movement.
"""
# Generate videos
generate_video(prompt_1, "output/masjid_nabawi.mp4")
generate_video(prompt_2, "output/kaaba_tawaf.mp4")
generate_video(prompt_3, "output/turkish_mosque.mp4")
print("\nโ
Selesai! Cek folder output")
Cell 4: Download Results
# Cell 4: Download links
from IPython.display import FileLink
videos = ["masjid_nabawi.mp4", "kaaba_tawaf.mp4", "turkish_mosque.mp4"]
print("๐ฅ Download links:")
for v in videos:
path = f"output/{v}"
if os.path.exists(path):
display(FileLink(path))
๐จ Prompt Templates untuk Travel/Umroh
๐ Masjid Nabawi
A beautiful aerial view of Masjid Nabawi in Medina during golden hour sunset. The green dome is visible in the center, surrounded by white minarets. Pilgrims in white ihram clothing are walking around the courtyard. Warm golden light bathes the entire scene. Cinematic photography style, smooth camera movement, peaceful and spiritual atmosphere.
๐ Kaaba Tawaf
Holy Kaaba in Mecca surrounded by hundreds of pilgrims performing tawaf. Aerial view showing the circular movement of people around the Kaaba. Dramatic sky with golden clouds at sunset. Spiritual atmosphere, cinematic wide angle shot, smooth camera pan.
๐ Turkish Mosque
Interior of a beautiful Ottoman mosque in Istanbul, Turkey. Sunlight streaming through stained glass windows creating colorful light patterns. Ornate Islamic calligraphy on the walls, grand chandeliers hanging from the ceiling. Peaceful atmosphere, cinematic slow camera movement.
๐ฝ๏ธ Turkish Food
Close-up shot of traditional Turkish kebab being prepared at a street food stall. Steam rising from the sizzling meat, fresh vegetables and bread on the side. Warm lighting, shallow depth of field, cinematic food photography style.
๐ฅ Group Pilgrims
Group of Muslim pilgrims smiling and taking photos together in front of the Prophet's Mosque in Medina. Happy faces, white ihram clothing, beautiful sunset background. Warm and joyful atmosphere, candid documentary style photography.