Aluren commited on
Commit
5a8758c
·
verified ·
1 Parent(s): 497be0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -13
app.py CHANGED
@@ -7,8 +7,8 @@ import spaces
7
  import gradio as gr
8
  import numpy as np
9
  import torch
10
- from gradio_image_prompter import ImagePrompter
11
- from gradio_litmodel3d import LitModel3D
12
  from huggingface_hub import snapshot_download
13
  from PIL import Image
14
  import trimesh
@@ -30,7 +30,7 @@ REPO_ID = "VAST-AI/DetailGen3D" # 似乎还没有
30
 
31
  MARKDOWN = """
32
  ## Generating geometry details guided by reference image with [DetailGen3D](https://detailgen3d.github.io/DetailGen3D/)
33
- 1. Upload a detailed image of the frontal view and a coarse model. Then clik "Run " to generate the refined result.
34
  2. If you find the generated 3D scene satisfactory, download it by clicking the "Download GLB" button.
35
  3. If you want the refine result to be more consistent with the image, please manually increase the CFG strength.
36
  """
@@ -40,11 +40,38 @@ EXAMPLES = [
40
  "assets/model/100.glb",
41
  42,
42
  False,
43
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  ]
45
- # {
46
- # "image": "assets/image/100.png",
47
- # },
48
 
49
 
50
  os.makedirs(TMP_DIR, exist_ok=True)
@@ -126,11 +153,6 @@ def run_refinement(
126
  if randomize_seed:
127
  seed = random.randint(0, MAX_SEED)
128
 
129
- # if not isinstance(rgb_image, Image.Image) and "image" in rgb_image:
130
- # rgb_image = rgb_image["image"]
131
-
132
- # print("rgb_image",rgb_image)
133
-
134
  scene = run_detailgen3d(
135
  pipeline,
136
  rgb_image,
@@ -180,7 +202,7 @@ with gr.Blocks() as demo:
180
  step=0.1,
181
  value=4.0,
182
  )
183
- gen_button = gr.Button("Generate details", variant="primary")
184
 
185
  with gr.Column():
186
  mesh = gr.Model3D(label="Input Coarse Model",camera_position=(90,90,3))
 
7
  import gradio as gr
8
  import numpy as np
9
  import torch
10
+ # from gradio_image_prompter import ImagePrompter
11
+ # from gradio_litmodel3d import LitModel3D
12
  from huggingface_hub import snapshot_download
13
  from PIL import Image
14
  import trimesh
 
30
 
31
  MARKDOWN = """
32
  ## Generating geometry details guided by reference image with [DetailGen3D](https://detailgen3d.github.io/DetailGen3D/)
33
+ 1. Upload a detailed image of the frontal view and a coarse model. Then clik "Generate Details" to generate the refined result.
34
  2. If you find the generated 3D scene satisfactory, download it by clicking the "Download GLB" button.
35
  3. If you want the refine result to be more consistent with the image, please manually increase the CFG strength.
36
  """
 
40
  "assets/model/100.glb",
41
  42,
42
  False,
43
+ ],
44
+ [
45
+ "assets/image/503d193a-1b9b-4685-b05f-00ac82f93d7b.png",
46
+ "assets/model/503d193a-1b9b-4685-b05f-00ac82f93d7b.glb",
47
+ 42,
48
+ False,
49
+ ],
50
+ [
51
+ "assets/image/34933195-9c2c-4271-8d31-a28bc5348b7a.png",
52
+ "assets/model/34933195-9c2c-4271-8d31-a28bc5348b7a.glb",
53
+ 42,
54
+ False,
55
+ ],
56
+ [
57
+ "assets/image/a5d09c66-1617-465c-aec9-431f48d9a7e1.png",
58
+ "assets/model/a5d09c66-1617-465c-aec9-431f48d9a7e1.glb",
59
+ 42,
60
+ False,
61
+ ],
62
+ [
63
+ "assets/image/cb7e6c4a-b4dd-483c-9789-3d4887ee7434.png",
64
+ "assets/model/cb7e6c4a-b4dd-483c-9789-3d4887ee7434.glb",
65
+ 42,
66
+ False,
67
+ ],
68
+ [
69
+ "assets/image/e799e6b4-3b47-40e0-befb-b156af8758ad.png",
70
+ "assets/model/instant3d/e799e6b4-3b47-40e0-befb-b156af8758ad.glb",
71
+ 42,
72
+ False,
73
+ ],
74
  ]
 
 
 
75
 
76
 
77
  os.makedirs(TMP_DIR, exist_ok=True)
 
153
  if randomize_seed:
154
  seed = random.randint(0, MAX_SEED)
155
 
 
 
 
 
 
156
  scene = run_detailgen3d(
157
  pipeline,
158
  rgb_image,
 
202
  step=0.1,
203
  value=4.0,
204
  )
205
+ gen_button = gr.Button("Generate Details", variant="primary")
206
 
207
  with gr.Column():
208
  mesh = gr.Model3D(label="Input Coarse Model",camera_position=(90,90,3))