xinjie.wang commited on
Commit
74fb66c
·
1 Parent(s): f3347e3
Files changed (1) hide show
  1. common.py +38 -38
common.py CHANGED
@@ -107,44 +107,44 @@ if os.getenv("GRADIO_APP").startswith("imageto3d"):
107
  os.path.dirname(os.path.abspath(__file__)), "sessions/imageto3d"
108
  )
109
  os.makedirs(TMP_DIR, exist_ok=True)
110
- elif os.getenv("GRADIO_APP").startswith("textto3d"):
111
- RBG_REMOVER = RembgRemover()
112
- RBG14_REMOVER = BMGG14Remover()
113
- if "sam3d" in os.getenv("GRADIO_APP"):
114
- PIPELINE = Sam3dInference()
115
- else:
116
- PIPELINE = TrellisImageTo3DPipeline.from_pretrained(
117
- "microsoft/TRELLIS-image-large"
118
- )
119
- # PIPELINE.cuda()
120
- text_model_dir = "weights/Kolors"
121
- PIPELINE_IMG_IP = build_text2img_ip_pipeline(text_model_dir, ref_scale=0.3)
122
- PIPELINE_IMG = build_text2img_pipeline(text_model_dir)
123
- SEG_CHECKER = ImageSegChecker(GPT_CLIENT)
124
- GEO_CHECKER = MeshGeoChecker(GPT_CLIENT)
125
- AESTHETIC_CHECKER = ImageAestheticChecker()
126
- CHECKERS = [GEO_CHECKER, SEG_CHECKER, AESTHETIC_CHECKER]
127
- TMP_DIR = os.path.join(
128
- os.path.dirname(os.path.abspath(__file__)), "sessions/textto3d"
129
- )
130
- os.makedirs(TMP_DIR, exist_ok=True)
131
- elif os.getenv("GRADIO_APP") == "texture_edit":
132
- DELIGHT = DelightingModel()
133
- IMAGESR_MODEL = ImageRealESRGAN(outscale=4)
134
- PIPELINE_IP = build_texture_gen_pipe(
135
- base_ckpt_dir="./weights",
136
- ip_adapt_scale=0.7,
137
- device="cuda",
138
- )
139
- PIPELINE = build_texture_gen_pipe(
140
- base_ckpt_dir="./weights",
141
- ip_adapt_scale=0,
142
- device="cuda",
143
- )
144
- TMP_DIR = os.path.join(
145
- os.path.dirname(os.path.abspath(__file__)), "sessions/texture_edit"
146
- )
147
- os.makedirs(TMP_DIR, exist_ok=True)
148
 
149
 
150
  def start_session(req: gr.Request) -> None:
 
107
  os.path.dirname(os.path.abspath(__file__)), "sessions/imageto3d"
108
  )
109
  os.makedirs(TMP_DIR, exist_ok=True)
110
+ # elif os.getenv("GRADIO_APP").startswith("textto3d"):
111
+ # RBG_REMOVER = RembgRemover()
112
+ # RBG14_REMOVER = BMGG14Remover()
113
+ # if "sam3d" in os.getenv("GRADIO_APP"):
114
+ # PIPELINE = Sam3dInference()
115
+ # else:
116
+ # PIPELINE = TrellisImageTo3DPipeline.from_pretrained(
117
+ # "microsoft/TRELLIS-image-large"
118
+ # )
119
+ # # PIPELINE.cuda()
120
+ # text_model_dir = "weights/Kolors"
121
+ # PIPELINE_IMG_IP = build_text2img_ip_pipeline(text_model_dir, ref_scale=0.3)
122
+ # PIPELINE_IMG = build_text2img_pipeline(text_model_dir)
123
+ # SEG_CHECKER = ImageSegChecker(GPT_CLIENT)
124
+ # GEO_CHECKER = MeshGeoChecker(GPT_CLIENT)
125
+ # AESTHETIC_CHECKER = ImageAestheticChecker()
126
+ # CHECKERS = [GEO_CHECKER, SEG_CHECKER, AESTHETIC_CHECKER]
127
+ # TMP_DIR = os.path.join(
128
+ # os.path.dirname(os.path.abspath(__file__)), "sessions/textto3d"
129
+ # )
130
+ # os.makedirs(TMP_DIR, exist_ok=True)
131
+ # elif os.getenv("GRADIO_APP") == "texture_edit":
132
+ # DELIGHT = DelightingModel()
133
+ # IMAGESR_MODEL = ImageRealESRGAN(outscale=4)
134
+ # PIPELINE_IP = build_texture_gen_pipe(
135
+ # base_ckpt_dir="./weights",
136
+ # ip_adapt_scale=0.7,
137
+ # device="cuda",
138
+ # )
139
+ # PIPELINE = build_texture_gen_pipe(
140
+ # base_ckpt_dir="./weights",
141
+ # ip_adapt_scale=0,
142
+ # device="cuda",
143
+ # )
144
+ # TMP_DIR = os.path.join(
145
+ # os.path.dirname(os.path.abspath(__file__)), "sessions/texture_edit"
146
+ # )
147
+ # os.makedirs(TMP_DIR, exist_ok=True)
148
 
149
 
150
  def start_session(req: gr.Request) -> None: