prithivMLmods commited on
Commit
56aa407
·
verified ·
1 Parent(s): 573a8ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -333,7 +333,7 @@ def generate(
333
  num_steps=64,
334
  randomize_seed=True,
335
  )
336
- # Instead of embedding via data URL, copy the GLB file to a static folder.
337
  static_folder = os.path.join(os.getcwd(), "static")
338
  if not os.path.exists(static_folder):
339
  os.makedirs(static_folder)
@@ -476,6 +476,14 @@ demo = gr.ChatInterface(
476
  multimodal=True,
477
  )
478
 
 
 
 
 
 
 
 
 
479
  if __name__ == "__main__":
480
- # To serve the generated GLB files, add the static directory.
481
- demo.queue(max_size=20).launch(share=True, static_dirs={"static": "static"})
 
333
  num_steps=64,
334
  randomize_seed=True,
335
  )
336
+ # Copy the GLB file to a static folder.
337
  static_folder = os.path.join(os.getcwd(), "static")
338
  if not os.path.exists(static_folder):
339
  os.makedirs(static_folder)
 
476
  multimodal=True,
477
  )
478
 
479
+ # Ensure the static folder exists
480
+ if not os.path.exists("static"):
481
+ os.makedirs("static")
482
+
483
+ # Mount the static folder onto the FastAPI app so that GLB files are served.
484
+ from fastapi.staticfiles import StaticFiles
485
+ demo.app.mount("/static", StaticFiles(directory="static"), name="static")
486
+
487
  if __name__ == "__main__":
488
+ # Launch without the unsupported static_dirs parameter.
489
+ demo.queue(max_size=20).launch(share=True)