Skip to content

Commit

Permalink
Selective merge Tencent#93 from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
YanWenKun committed Feb 15, 2025
2 parents 6a66ef0 + 0b283f3 commit 5f5cd78
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions gradio_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _gen_shape(
seed=1234,
octree_resolution=256,
check_box_rembg=False,
max_facenum = 40000,
max_facenum=40000,
):
if caption: print('prompt is', caption)
save_folder = gen_save_folder()
Expand Down Expand Up @@ -153,7 +153,7 @@ def generation_all(
seed=1234,
octree_resolution=256,
check_box_rembg=False,
max_facenum = 40000
max_facenum=40000
):
mesh, image, save_folder = _gen_shape(
caption,
Expand Down Expand Up @@ -189,7 +189,7 @@ def shape_generation(
seed=1234,
octree_resolution=256,
check_box_rembg=False,
max_facenum = 40000
max_facenum=40000
):
mesh, image, save_folder = _gen_shape(
caption,
Expand Down Expand Up @@ -340,6 +340,11 @@ def build_app():
if __name__ == '__main__':
import argparse

# --- CUDA Availability Check ---
if not torch.cuda.is_available():
print("WARNING: CUDA is not available. The application will run on the CPU, which will be significantly slower.")
# Consider raising an exception here if GPU is required

parser = argparse.ArgumentParser()
parser.add_argument('--port', type=int, default=8080)
parser.add_argument('--host', type=str, default='0.0.0.0')
Expand Down Expand Up @@ -381,10 +386,13 @@ def build_app():

HAS_T2I = False
if args.enable_t23d:
from hy3dgen.text2image import HunyuanDiTPipeline

t2i_worker = HunyuanDiTPipeline('Tencent-Hunyuan/HunyuanDiT-v1.1-Diffusers-Distilled')
HAS_T2I = True
try:
from hy3dgen.text2image import HunyuanDiTPipeline
t2i_worker = HunyuanDiTPipeline('Tencent-Hunyuan/HunyuanDiT-v1.1-Diffusers-Distilled')
HAS_T2I = True
except Exception as e:
print(f"Failed to load text-to-image pipeline: {e}")
print("Text-to-image generation will be disabled.")

from hy3dgen.shapegen import FaceReducer, FloaterRemover, DegenerateFaceRemover, \
Hunyuan3DDiTFlowMatchingPipeline
Expand Down

0 comments on commit 5f5cd78

Please sign in to comment.