Spaces:
Running
Running
File size: 2,737 Bytes
9fa4d05 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
#!/usr/bin/env python3
"""
Simple test script for Audio2KineticVid components.
This tests each pipeline component individually.
"""
import os
import sys
from PIL import Image
def run_tests():
print("Testing Audio2KineticVid components...")
# Test for demo audio file
if not os.path.exists("demo.mp3"):
print("β No demo.mp3 found. Please add a short audio file for testing.")
print(" Continuing with partial tests...")
else:
print("β
Demo audio file found")
# Test GPU availability
import torch
if torch.cuda.is_available():
print(f"β
GPU available: {torch.cuda.get_device_name(0)}")
print(f" VRAM: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.1f} GB")
else:
print("β No GPU available! This app requires a CUDA-capable GPU.")
return False
# Test imports
try:
print("Testing imports...")
import gradio
import whisper
import transformers
import diffusers
print("β
All required libraries imported successfully")
except ImportError as e:
print(f"β Import error: {e}")
print(" Make sure you've installed all dependencies: pip install -r requirements.txt")
return False
# Test module imports
try:
print("Testing module imports...")
from utils.transcribe import list_available_whisper_models
from utils.prompt_gen import list_available_llm_models
from utils.video_gen import list_available_image_models
print(f"β
Available Whisper models: {list_available_whisper_models()[:3]}...")
print(f"β
Available LLM models: {list_available_llm_models()[:2]}...")
print(f"β
Available Image models: {list_available_image_models()[:2]}...")
except Exception as e:
print(f"β Module import error: {e}")
return False
# Test text-to-image (lightweight test)
try:
print("Testing image generation (minimal)...")
from utils.video_gen import preview_image_generation
# Use a very small model for quick testing
test_image = preview_image_generation(
"A blue sky with clouds",
image_model="runwayml/stable-diffusion-v1-5",
width=256,
height=256
)
test_image.save("test_image.png")
print(f"β
Generated test image: test_image.png")
except Exception as e:
print(f"β Image generation error: {e}")
import traceback
traceback.print_exc()
print("\nTests completed!")
return True
if __name__ == "__main__":
success = run_tests()
sys.exit(0 if success else 1) |