Spaces:
Running
Running
Update app.py
Browse files
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)
|
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 |
-
|
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 =====")
|