Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| import sys | |
| import traceback | |
| from pathlib import Path | |
| # Add the app directory to Python path | |
| sys.path.insert(0, str(Path(__file__).parent / "app")) | |
| try: | |
| from core.card_renderer import generate_card | |
| from core.config import settings | |
| print('Testing card renderer...') | |
| # Test parameters | |
| card_design_id = 1 | |
| symbol_ids = [1, 2] | |
| text = 'Test card text for debugging' | |
| file_id = generate_card( | |
| card_design_id=card_design_id, | |
| symbol_ids=symbol_ids, | |
| text=text, | |
| base_images_path=settings.resolved_base_path, | |
| symbols_images_path=settings.resolved_symbols_path, | |
| font_path=settings.resolved_default_font_path, | |
| output_path=settings.resolved_generated_path, | |
| request_id='test-12345' | |
| ) | |
| print(f'Success! Generated card with ID: {file_id}') | |
| # Check if file was created | |
| output_file = settings.resolved_generated_path / f'{file_id}.png' | |
| print(f'File exists: {output_file.exists()}') | |
| if output_file.exists(): | |
| print(f'File size: {output_file.stat().st_size} bytes') | |
| except Exception as e: | |
| print(f'Error: {type(e).__name__}: {str(e)}') | |
| traceback.print_exc() | |