mike23415 commited on
Commit
16f183a
·
verified ·
1 Parent(s): 31cc64d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -12,14 +12,17 @@ logger = logging.getLogger(__name__)
12
 
13
  app = Flask(__name__)
14
 
15
- # Load the model once at startup (on CPU) without token (test only)
16
  try:
17
  logger.info("Loading TencentARC InstantMesh pipeline...")
 
 
 
18
  pipe = StableDiffusionPipeline.from_pretrained(
19
  "TencentARC/InstantMesh",
20
  torch_dtype=torch.float32,
21
  cache_dir="/tmp/hf_home",
22
- # token=token, # Comment out or remove for test
23
  )
24
  pipe.to("cpu")
25
  logger.info("=== Application Startup at CPU mode =====")
 
12
 
13
  app = Flask(__name__)
14
 
15
+ # Load the model once at startup (on CPU) with token from environment
16
  try:
17
  logger.info("Loading TencentARC InstantMesh pipeline...")
18
+ token = os.getenv("HF_TOKEN")
19
+ if not token:
20
+ raise ValueError("HF_TOKEN environment variable not set")
21
  pipe = StableDiffusionPipeline.from_pretrained(
22
  "TencentARC/InstantMesh",
23
  torch_dtype=torch.float32,
24
  cache_dir="/tmp/hf_home",
25
+ token=token, # Reintroduce token authentication
26
  )
27
  pipe.to("cpu")
28
  logger.info("=== Application Startup at CPU mode =====")