Spaces:
Running
on
Zero
Running
on
Zero
File size: 2,531 Bytes
75d84c2 27fc85d 5ecc81f 27fc85d 75d84c2 5ecc81f d02142b 5ecc81f 27fc85d f882a9b 5ecc81f cf9d1e9 d21d83c d02142b d21d83c d02142b 957ab04 d21d83c 957ab04 d02142b 5ecc81f cf9d1e9 d02142b 5ecc81f f882a9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
import spaces
import gradio as gr
from glob import glob
@spaces.GPU(duration=60)
def gen_shape():
print("do nothing")
def get_example_img_list():
print('Loading example img list ...')
return sorted(glob('./assets/example_images/**/*.png', recursive=True))
example_imgs = get_example_img_list()
HTML_OUTPUT_PLACEHOLDER = f"""
<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;'>
<div style='text-align: center; font-size: 16px; color: #6b7280;'>
<p style="color: #8d8d8d;">Welcome to Hunyuan3D!</p>
<p style="color: #8d8d8d;">No mesh here.</p>
</div>
</div>
"""
MAX_SEED = 1e7
title = "## Image to 3D"
description = "A lightweight image to 3D converter"
with gr.Blocks().queue() as demo:
gr.Markdown(title)
gr.Markdown(description)
with gr.Row():
with gr.Column(scale=3):
gr.Markdown("#### Image Prompt")
image = gr.Image(sources=["upload"], label='Image', type='pil', image_mode='RGBA', height=290)
gen_button = gr.Button(value='Generate Shape', variant='primary')
with gr.Accordion("Advanced Options", open=False):
seed = gr.Slider(
label="Seed",
minimum=0,
maximum=MAX_SEED,
step=1,
value=1234,
min_width=100,
)
with gr.Column():
num_steps = gr.Slider(maximum=100, minimum=1, value=5, step=1, label='Inference Steps')
octree_resolution = gr.Slider(maximum=512, minimum=16, value=256, label='Octree Resolution')
with gr.Column():
cfg_scale = gr.Slider(maximum=20.0, minimum=1.0, value=5.5, step=0.1, label='Guidance Scale')
num_chunks = gr.Slider(maximum=5000000, minimum=1000, value=8000, label='Number of Chunks')
target_face_num = gr.Slider(maximum=1000000, minimum=100, value=10000, label='Target Face Number')
with gr.Column(scale=6):
gr.Markdown("#### Generated Mesh")
html_export_mesh = gr.HTML(HTML_OUTPUT_PLACEHOLDER, label='Output')
with gr.Column(scale=3):
gr.Markdown("#### Image Examples")
gr.Examples(examples=example_imgs, inputs=[image],
label=None, examples_per_page=18)
demo.launch() |