#!/usr/bin/env python3 """ Quick test script to validate the new HuggingFace InferenceClient implementation """ import os import sys from pathlib import Path # Add the current directory to the Python path sys.path.append(str(Path(__file__).parent)) from models.image_generator import ImageGenerator def test_image_generation(): """Test the new image generation implementation""" print("šŸš€ Testing new HuggingFace InferenceClient implementation...") # Initialize the image generator generator = ImageGenerator() # Test prompt test_prompt = "a futuristic robot in a cyberpunk cityscape" try: print(f"šŸ“ Generating image for prompt: '{test_prompt}'") # Generate image result = generator.generate_image(test_prompt) if result and "image_url" in result: print(f"āœ… Success! Image generated successfully") print(f"šŸ”— Image URL: {result['image_url']}") return True else: print(f"āŒ Failed: {result}") return False except Exception as e: print(f"āŒ Error during generation: {str(e)}") return False if __name__ == "__main__": success = test_image_generation() if success: print("\nšŸŽ‰ New API implementation is working correctly!") else: print("\nšŸ’„ Issues detected with the new implementation") sys.exit(0 if success else 1)