Spaces:
Sleeping
Sleeping
| """Test if torch and diffusers can be imported""" | |
| import sys | |
| import os | |
| os.environ['HF_HOME'] = 'd:/VSC Codes/Bild/.cache/hf' | |
| os.environ['TRANSFORMERS_CACHE'] = 'd:/VSC Codes/Bild/.cache/hf' | |
| print("Testing torch import...") | |
| try: | |
| import torch | |
| print(f"β torch imported successfully") | |
| print(f" Version: {torch.__version__}") | |
| print(f" CUDA available: {torch.cuda.is_available()}") | |
| if hasattr(torch.cuda, 'get_device_name') and torch.cuda.is_available(): | |
| print(f" CUDA device: {torch.cuda.get_device_name(0)}") | |
| except Exception as e: | |
| print(f"β Failed to import torch: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| sys.exit(1) | |
| print("\nTesting diffusers import...") | |
| try: | |
| from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline | |
| print(f"β diffusers imported successfully") | |
| except Exception as e: | |
| print(f"β Failed to import diffusers: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| sys.exit(1) | |
| print("\nβββ All imports successful! Provider should be available.") | |
| print("\nTesting provider availability...") | |
| sys.path.insert(0, 'd:/VSC Codes/Bild/imageforge') | |
| try: | |
| from backend.app.providers.localai_provider import LocalAIProvider | |
| provider = LocalAIProvider() | |
| available = provider.is_available() | |
| print(f"LocalAI Provider available: {available}") | |
| if not available: | |
| print("β Provider reports as unavailable despite successful imports!") | |
| print("This is unexpected - checking engine...") | |
| from backend.app.local_ai.engine import LocalAIEngine | |
| engine = LocalAIEngine() | |
| print(f" Engine available: {engine.is_available()}") | |
| else: | |
| print("β Provider is available!") | |
| except Exception as e: | |
| print(f"β Failed to check provider: {e}") | |
| import traceback | |
| traceback.print_exc() | |