Update processing/ai_background.py
Browse files- processing/ai_background.py +11 -4
processing/ai_background.py
CHANGED
|
@@ -258,10 +258,15 @@ def generate_ai_background(prompt: str, width: int = 1024, height: int = 768) ->
|
|
| 258 |
|
| 259 |
# Example usage and testing
|
| 260 |
if __name__ == "__main__":
|
| 261 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
test_prompts = [
|
| 263 |
"professional office environment",
|
| 264 |
-
"peaceful ocean sunset",
|
| 265 |
"dark forest at night",
|
| 266 |
"modern corporate meeting room",
|
| 267 |
"abstract blue technology background"
|
|
@@ -287,11 +292,13 @@ def generate_ai_background(prompt: str, width: int = 1024, height: int = 768) ->
|
|
| 287 |
except Exception as e:
|
| 288 |
print(f"✗ Error: {e}")
|
| 289 |
|
| 290 |
-
print(f"\
|
| 291 |
print(f"- PIL Available: {PIL_AVAILABLE}")
|
| 292 |
print(f"- PyTorch Available: {TORCH_AVAILABLE}")
|
| 293 |
print(f"- Diffusers Available: {DIFFUSERS_AVAILABLE}")
|
| 294 |
if generator.pipeline:
|
| 295 |
print(f"- Device: {generator.device}")
|
|
|
|
| 296 |
else:
|
| 297 |
-
print("- AI Pipeline: Not initialized
|
|
|
|
|
|
| 258 |
|
| 259 |
# Example usage and testing
|
| 260 |
if __name__ == "__main__":
|
| 261 |
+
# Quick test first
|
| 262 |
+
if not test_background_generation():
|
| 263 |
+
print("Exiting due to test failure")
|
| 264 |
+
sys.exit(1)
|
| 265 |
+
|
| 266 |
+
# Full test suite
|
| 267 |
test_prompts = [
|
| 268 |
"professional office environment",
|
| 269 |
+
"peaceful ocean sunset",
|
| 270 |
"dark forest at night",
|
| 271 |
"modern corporate meeting room",
|
| 272 |
"abstract blue technology background"
|
|
|
|
| 292 |
except Exception as e:
|
| 293 |
print(f"✗ Error: {e}")
|
| 294 |
|
| 295 |
+
print(f"\nFinal module status:")
|
| 296 |
print(f"- PIL Available: {PIL_AVAILABLE}")
|
| 297 |
print(f"- PyTorch Available: {TORCH_AVAILABLE}")
|
| 298 |
print(f"- Diffusers Available: {DIFFUSERS_AVAILABLE}")
|
| 299 |
if generator.pipeline:
|
| 300 |
print(f"- Device: {generator.device}")
|
| 301 |
+
print("- Mode: AI Generation (Stable Diffusion)")
|
| 302 |
else:
|
| 303 |
+
print("- AI Pipeline: Not initialized")
|
| 304 |
+
print("- Mode: Gradient Fallback Only")
|