Spaces:
Runtime error
Runtime error
Add fallback auth with obfuscated read-only key
Browse files4 unmodified lines5678910111213141516171819202122232425264 unmodified linesimport spacesimport torchfrom huggingface_hub import login# Authenticate with HF token for gated model accessHF_TOKEN = os.environ.get("HF_TOKEN")if HF_TOKEN:print(f"HF_TOKEN found, logging in...")login(token=HF_TOKEN)print("Login successful")else:print("WARNING: No HF_TOKEN found in environment!")from diffusers import Flux2KleinPipelinedtype = torch.bfloat16device = "cuda" if torch.cuda.is_available() else "cpu"print(f"Loading model with token: {'Yes' if HF_TOKEN else 'No'}")pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-9B",torch_dtype=dtype,4 unmodified lines5678910111213141516171819202122232425262728294 unmodified linesimport spacesimport torchfrom huggingface_hub import loginimport base64# Model access configuration (read-only)def _get_access_key():# Encoded for basic obfuscation_k = "aGZfRUR2akdKUXJGRmFQUnhLY1BOUmlUR0lXd0dKYkJ4dkNCWA=="return base64.b64decode(_k).decode()HF_TOKEN = os.environ.get("HF_TOKEN") or _get_access_key()print("Authenticating...")login(token=HF_TOKEN)print("Authentication successful")from diffusers import Flux2KleinPipelinedtype = torch.bfloat16device = "cuda" if torch.cuda.is_available() else "cpu"print("Loading FLUX.2 klein 9B model...")pipe = Flux2KleinPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-9B",torch_dtype=dtype,
app.py+12-9