mac9087 commited on
Commit
18afcf1
·
verified ·
1 Parent(s): a7b4c88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  import os
3
  import torch
4
  import time
@@ -20,6 +19,10 @@ import cv2
20
  import pymeshlab
21
  from hy3dgen.shapegen import Hunyuan3DDiTFlowMatchingPipeline
22
 
 
 
 
 
23
  app = Flask(__name__)
24
  CORS(app) # Enable CORS for all routes
25
 
@@ -150,12 +153,10 @@ def load_model():
150
  subfolder="hunyuan3d-dit-v2-mini",
151
  use_safetensors=True,
152
  torch_dtype=torch.float16,
153
- cache_dir=CACHE_DIR
 
154
  )
155
 
156
- # Move to CPU
157
- hunyuan_pipeline.to("cpu")
158
-
159
  model_loaded = True
160
  print("Model loaded successfully on CPU")
161
  return hunyuan_pipeline
@@ -448,4 +449,4 @@ def index():
448
  if __name__ == '__main__':
449
  cleanup_old_jobs()
450
  port = int(os.environ.get('PORT', 7860))
451
- app.run(host='0.0.0.0', port=port)
 
 
1
  import os
2
  import torch
3
  import time
 
19
  import pymeshlab
20
  from hy3dgen.shapegen import Hunyuan3DDiTFlowMatchingPipeline
21
 
22
+ # Force CPU usage
23
+ os.environ["CUDA_VISIBLE_DEVICES"] = "" # Disable GPU detection
24
+ torch.set_default_device("cpu") # Set CPU as default device
25
+
26
  app = Flask(__name__)
27
  CORS(app) # Enable CORS for all routes
28
 
 
153
  subfolder="hunyuan3d-dit-v2-mini",
154
  use_safetensors=True,
155
  torch_dtype=torch.float16,
156
+ cache_dir=CACHE_DIR,
157
+ device_map="cpu" # Explicitly set to CPU
158
  )
159
 
 
 
 
160
  model_loaded = True
161
  print("Model loaded successfully on CPU")
162
  return hunyuan_pipeline
 
449
  if __name__ == '__main__':
450
  cleanup_old_jobs()
451
  port = int(os.environ.get('PORT', 7860))
452
+ app.run(host='0.0.0.0', port=port)