Spaces:
Runtime error
Runtime error
Upload gradio_app.py
Browse files- gradio_app.py +14 -9
gradio_app.py
CHANGED
|
@@ -43,13 +43,9 @@ if True:
|
|
| 43 |
print('install custom')
|
| 44 |
subprocess.run(shlex.split("pip install custom_rasterizer-0.1-cp310-cp310-linux_x86_64.whl"), check=True)
|
| 45 |
|
| 46 |
-
# 2 functions just for GPU usage at startup
|
| 47 |
@spaces.GPU
|
| 48 |
def my_gpu_function():
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
def call_gpu_function():
|
| 52 |
-
return my_gpu_function() # Only called on Gradio event
|
| 53 |
|
| 54 |
def get_example_img_list():
|
| 55 |
print('Loading example img list ...')
|
|
@@ -596,6 +592,16 @@ def build_app():
|
|
| 596 |
outputs=[tabs_output],
|
| 597 |
)
|
| 598 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
def on_gen_mode_change(value):
|
| 600 |
if value == 'Turbo':
|
| 601 |
return gr.update(value=5)
|
|
@@ -671,7 +677,7 @@ if __name__ == '__main__':
|
|
| 671 |
parser.add_argument("--model_path", type=str, default='tencent/Hunyuan3D-2mv')
|
| 672 |
parser.add_argument("--subfolder", type=str, default='hunyuan3d-dit-v2-mv-turbo')
|
| 673 |
parser.add_argument("--texgen_model_path", type=str, default='tencent/Hunyuan3D-2')
|
| 674 |
-
parser.add_argument('--port', type=
|
| 675 |
parser.add_argument('--host', type=str, default='0.0.0.0')
|
| 676 |
parser.add_argument('--device', type=str, default='cuda')
|
| 677 |
parser.add_argument('--mc_algo', type=str, default='mc')
|
|
@@ -689,6 +695,8 @@ if __name__ == '__main__':
|
|
| 689 |
print(f"Invalid port argument detected: {args.port} β using default 7860")
|
| 690 |
port = 7860
|
| 691 |
|
|
|
|
|
|
|
| 692 |
args.enable_flashvdm = True
|
| 693 |
SAVE_DIR = args.cache_path
|
| 694 |
os.makedirs(SAVE_DIR, exist_ok=True)
|
|
@@ -714,9 +722,6 @@ if __name__ == '__main__':
|
|
| 714 |
</div>
|
| 715 |
"""
|
| 716 |
|
| 717 |
-
gpu_usage = gr.Interface(fn=call_gpu_function, inputs=[], outputs="text")
|
| 718 |
-
gpu_usage.launch()
|
| 719 |
-
|
| 720 |
example_is = get_example_img_list()
|
| 721 |
example_ts = get_example_txt_list()
|
| 722 |
example_mvs = get_example_mv_list()
|
|
|
|
| 43 |
print('install custom')
|
| 44 |
subprocess.run(shlex.split("pip install custom_rasterizer-0.1-cp310-cp310-linux_x86_64.whl"), check=True)
|
| 45 |
|
|
|
|
| 46 |
@spaces.GPU
|
| 47 |
def my_gpu_function():
|
| 48 |
+
pass
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
def get_example_img_list():
|
| 51 |
print('Loading example img list ...')
|
|
|
|
| 592 |
outputs=[tabs_output],
|
| 593 |
)
|
| 594 |
|
| 595 |
+
# Button to trigger GPU function
|
| 596 |
+
run_button = gr.Button("")
|
| 597 |
+
|
| 598 |
+
# When button clicked -> call GPU function and update output_box
|
| 599 |
+
run_button.click(
|
| 600 |
+
fn=my_gpu_function,
|
| 601 |
+
inputs=[],
|
| 602 |
+
outputs=[]
|
| 603 |
+
)
|
| 604 |
+
|
| 605 |
def on_gen_mode_change(value):
|
| 606 |
if value == 'Turbo':
|
| 607 |
return gr.update(value=5)
|
|
|
|
| 677 |
parser.add_argument("--model_path", type=str, default='tencent/Hunyuan3D-2mv')
|
| 678 |
parser.add_argument("--subfolder", type=str, default='hunyuan3d-dit-v2-mv-turbo')
|
| 679 |
parser.add_argument("--texgen_model_path", type=str, default='tencent/Hunyuan3D-2')
|
| 680 |
+
parser.add_argument('--port', type=str, default='7860')
|
| 681 |
parser.add_argument('--host', type=str, default='0.0.0.0')
|
| 682 |
parser.add_argument('--device', type=str, default='cuda')
|
| 683 |
parser.add_argument('--mc_algo', type=str, default='mc')
|
|
|
|
| 695 |
print(f"Invalid port argument detected: {args.port} β using default 7860")
|
| 696 |
port = 7860
|
| 697 |
|
| 698 |
+
print("args:", args)
|
| 699 |
+
|
| 700 |
args.enable_flashvdm = True
|
| 701 |
SAVE_DIR = args.cache_path
|
| 702 |
os.makedirs(SAVE_DIR, exist_ok=True)
|
|
|
|
| 722 |
</div>
|
| 723 |
"""
|
| 724 |
|
|
|
|
|
|
|
|
|
|
| 725 |
example_is = get_example_img_list()
|
| 726 |
example_ts = get_example_txt_list()
|
| 727 |
example_mvs = get_example_mv_list()
|