frogleo commited on
Commit
d02142b
·
1 Parent(s): 5ecc81f

优化界面和交互

Browse files
Files changed (1) hide show
  1. app.py +36 -0
app.py CHANGED
@@ -12,6 +12,16 @@ def get_example_img_list():
12
  return sorted(glob('./assets/example_images/**/*.png', recursive=True))
13
  example_imgs = get_example_img_list()
14
 
 
 
 
 
 
 
 
 
 
 
15
  title = "## Image to 3D"
16
  description = "A lightweight image to 3D converter"
17
 
@@ -22,8 +32,34 @@ with gr.Blocks().queue() as demo:
22
  with gr.Column(scale=3):
23
  gr.Markdown("#### Image Prompt")
24
  image = gr.Image(sources=["upload"], label='Image', type='pil', image_mode='RGBA', height=290)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  with gr.Column(scale=6):
26
  gr.Markdown("#### Generated Mesh")
 
 
 
 
 
 
27
  with gr.Column(scale=3):
28
  gr.Markdown("#### Image Examples")
29
  gr.Examples(examples=example_imgs, inputs=[image],
 
12
  return sorted(glob('./assets/example_images/**/*.png', recursive=True))
13
  example_imgs = get_example_img_list()
14
 
15
+ HTML_OUTPUT_PLACEHOLDER = f"""
16
+ <div style='height: {650}px; width: 100%; border-radius: 8px; border-color: #e5e7eb; border-style: solid; border-width: 1px; display: flex; justify-content: center; align-items: center;'>
17
+ <div style='text-align: center; font-size: 16px; color: #6b7280;'>
18
+ <p style="color: #8d8d8d;">Welcome to Hunyuan3D!</p>
19
+ <p style="color: #8d8d8d;">No mesh here.</p>
20
+ </div>
21
+ </div>
22
+ """
23
+ MAX_SEED = 1e7
24
+
25
  title = "## Image to 3D"
26
  description = "A lightweight image to 3D converter"
27
 
 
32
  with gr.Column(scale=3):
33
  gr.Markdown("#### Image Prompt")
34
  image = gr.Image(sources=["upload"], label='Image', type='pil', image_mode='RGBA', height=290)
35
+ with gr.Column():
36
+ seed = gr.Slider(
37
+ label="Seed",
38
+ minimum=0,
39
+ maximum=MAX_SEED,
40
+ step=1,
41
+ value=1234,
42
+ min_width=100,
43
+ )
44
+ with gr.Column():
45
+ num_steps = gr.Slider(maximum=100,
46
+ minimum=1,
47
+ value=5,
48
+ step=1, label='Inference Steps')
49
+ octree_resolution = gr.Slider(maximum=512, minimum=16, value=256, label='Octree Resolution')
50
+ with gr.Column():
51
+ cfg_scale = gr.Number(value=5.0, label='Guidance Scale', min_width=100)
52
+ num_chunks = gr.Slider(maximum=5000000, minimum=1000, value=8000,
53
+ label='Number of Chunks', min_width=100)
54
+
55
  with gr.Column(scale=6):
56
  gr.Markdown("#### Generated Mesh")
57
+ with gr.Tabs(selected='gen_mesh_panel') as tabs_output:
58
+ with gr.Tab('Exporting Mesh', id='export_mesh_panel'):
59
+ html_export_mesh = gr.HTML(HTML_OUTPUT_PLACEHOLDER, label='Output')
60
+ with gr.Tab('Mesh Statistic', id='stats_panel'):
61
+ stats = gr.Json({}, label='Mesh Stats')
62
+
63
  with gr.Column(scale=3):
64
  gr.Markdown("#### Image Examples")
65
  gr.Examples(examples=example_imgs, inputs=[image],