PrismJeff commited on
Commit
c15a0e2
·
1 Parent(s): 476a8c0

Fix: gpu errro

Browse files
Files changed (1) hide show
  1. gradio_app(original).py +14 -5
gradio_app(original).py CHANGED
@@ -786,6 +786,20 @@ Fast for very complex cases, Standard seldom use.',
786
  return demo
787
 
788
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
789
  if __name__ == '__main__':
790
  import argparse
791
 
@@ -919,9 +933,4 @@ if __name__ == '__main__':
919
  demo = build_app()
920
  app = gr.mount_gradio_app(app, demo, path="/")
921
 
922
- if ENV == 'Huggingface':
923
- # for Zerogpu
924
- from spaces import zero
925
- zero.startup()
926
-
927
  uvicorn.run(app, host=args.host, port=args.port)
 
786
  return demo
787
 
788
 
789
+ def prepare_huggingface_env():
790
+ import subprocess, shlex, os
791
+ # wheel install / compile steps
792
+ subprocess.run(shlex.split(
793
+ "pip install custom_rasterizer-0.1-cp310-cp310-linux_x86_64.whl"), check=True)
794
+ os.system("cd ./hy3dpaint/DifferentiableRenderer && bash compile_mesh_painter.sh")
795
+
796
+ # --- function & class definitions (with @spaces.GPU) here ---
797
+
798
+ if ENV == "Huggingface":
799
+ prepare_huggingface_env()
800
+ from spaces import zero
801
+ zero.startup()
802
+
803
  if __name__ == '__main__':
804
  import argparse
805
 
 
933
  demo = build_app()
934
  app = gr.mount_gradio_app(app, demo, path="/")
935
 
 
 
 
 
 
936
  uvicorn.run(app, host=args.host, port=args.port)