Spaces:
Runtime error
Runtime error
path
Browse files
app.py
CHANGED
@@ -15,6 +15,7 @@ from michelangelo.utils.visualizers import html_util
|
|
15 |
|
16 |
import gradio as gr
|
17 |
|
|
|
18 |
|
19 |
gradio_cached_dir = "./gradio_cached_dir"
|
20 |
os.makedirs(gradio_cached_dir, exist_ok=True)
|
@@ -32,7 +33,7 @@ image_model_config_dict = OrderedDict({
|
|
32 |
# "config": "./configs/image_cond_diffuser_asl/image-ASLDM-256.yaml",
|
33 |
# "ckpt_path": "./checkpoints/image_cond_diffuser_asl/image-ASLDM-256.ckpt",
|
34 |
"config": "/home/user/app/configs/image_cond_diffuser_asl/image-ASLDM-256.yaml",
|
35 |
-
"ckpt_path": "
|
36 |
},
|
37 |
})
|
38 |
|
@@ -40,11 +41,13 @@ text_model_config_dict = OrderedDict({
|
|
40 |
"ASLDM-256": {
|
41 |
# "config": "./configs/text_cond_diffuser_asl/text-ASLDM-256.yaml",
|
42 |
# "ckpt_path": "./checkpoints/text_cond_diffuser_asl/text-ASLDM-256.ckpt",
|
43 |
-
"config": "
|
44 |
-
"ckpt_path": "
|
45 |
},
|
46 |
})
|
47 |
|
|
|
|
|
48 |
class InferenceModel(object):
|
49 |
model = None
|
50 |
name = ""
|
@@ -115,7 +118,9 @@ def load_model(model_name: str, model_config_dict: dict, inference_model: Infere
|
|
115 |
if hasattr(model_config, "model"):
|
116 |
model_config = model_config.model
|
117 |
|
118 |
-
|
|
|
|
|
119 |
model = model.to(device)
|
120 |
model = model.eval()
|
121 |
|
@@ -313,7 +318,7 @@ with gr.Blocks() as app:
|
|
313 |
gr.Markdown("2. Note that the Image-conditioned model is trained on multiple 3D datasets like ShapeNet and Objaverse")
|
314 |
gr.Markdown("3. We provide some examples for you to try. You can also upload images or text as input.")
|
315 |
gr.Markdown("4. Welcome to share your amazing results with us, and thanks for your interest in our work!")
|
316 |
-
|
317 |
with gr.Row():
|
318 |
with gr.Column():
|
319 |
|
@@ -363,6 +368,8 @@ with gr.Blocks() as app:
|
|
363 |
|
364 |
img.upload(disable_cache, outputs=cache_dir)
|
365 |
examples.select(set_cache, outputs=[img, cache_dir])
|
|
|
|
|
366 |
print(f'line:404: {cache_dir}')
|
367 |
btn_generate_img2obj.click(image2mesh, inputs=[img, image_dropdown_models, num_samples,
|
368 |
guidance_scale, octree_depth],
|
|
|
15 |
|
16 |
import gradio as gr
|
17 |
|
18 |
+
from huggingface_hub import snapshot_download
|
19 |
|
20 |
gradio_cached_dir = "./gradio_cached_dir"
|
21 |
os.makedirs(gradio_cached_dir, exist_ok=True)
|
|
|
33 |
# "config": "./configs/image_cond_diffuser_asl/image-ASLDM-256.yaml",
|
34 |
# "ckpt_path": "./checkpoints/image_cond_diffuser_asl/image-ASLDM-256.ckpt",
|
35 |
"config": "/home/user/app/configs/image_cond_diffuser_asl/image-ASLDM-256.yaml",
|
36 |
+
"ckpt_path": "image_cond_diffuser_asl/image-ASLDM-256.ckpt",
|
37 |
},
|
38 |
})
|
39 |
|
|
|
41 |
"ASLDM-256": {
|
42 |
# "config": "./configs/text_cond_diffuser_asl/text-ASLDM-256.yaml",
|
43 |
# "ckpt_path": "./checkpoints/text_cond_diffuser_asl/text-ASLDM-256.ckpt",
|
44 |
+
"config": "./configs/text_cond_diffuser_asl/text-ASLDM-256.yaml",
|
45 |
+
"ckpt_path": "text_cond_diffuser_asl/text-ASLDM-256.ckpt",
|
46 |
},
|
47 |
})
|
48 |
|
49 |
+
model_path = snapshot_download(repo_id="Maikou/Michelangelo/tree/main/checkpoints")
|
50 |
+
|
51 |
class InferenceModel(object):
|
52 |
model = None
|
53 |
name = ""
|
|
|
118 |
if hasattr(model_config, "model"):
|
119 |
model_config = model_config.model
|
120 |
|
121 |
+
ckpt_path = os.path.join(model_path, config_ckpt_path["ckpt_path"])
|
122 |
+
|
123 |
+
model = instantiate_from_config(model_config, ckpt_path=ckpt_path)
|
124 |
model = model.to(device)
|
125 |
model = model.eval()
|
126 |
|
|
|
318 |
gr.Markdown("2. Note that the Image-conditioned model is trained on multiple 3D datasets like ShapeNet and Objaverse")
|
319 |
gr.Markdown("3. We provide some examples for you to try. You can also upload images or text as input.")
|
320 |
gr.Markdown("4. Welcome to share your amazing results with us, and thanks for your interest in our work!")
|
321 |
+
|
322 |
with gr.Row():
|
323 |
with gr.Column():
|
324 |
|
|
|
368 |
|
369 |
img.upload(disable_cache, outputs=cache_dir)
|
370 |
examples.select(set_cache, outputs=[img, cache_dir])
|
371 |
+
print(os.path.abspath(os.path.dirname(__file__)))
|
372 |
+
print(model_path)
|
373 |
print(f'line:404: {cache_dir}')
|
374 |
btn_generate_img2obj.click(image2mesh, inputs=[img, image_dropdown_models, num_samples,
|
375 |
guidance_scale, octree_depth],
|