Commit c4ddb180 authored by chenpangpang's avatar chenpangpang
Browse files

feat: gradio页面改成中文

parent 085e3a62
...@@ -228,40 +228,12 @@ def make3d(images): ...@@ -228,40 +228,12 @@ def make3d(images):
import gradio as gr import gradio as gr
_HEADER_ = ''' _HEADER_ = '''
<h2><b>Official 🤗 Gradio Demo</b></h2><h2><a href='https://github.com/TencentARC/InstantMesh' target='_blank'><b>InstantMesh: Efficient 3D Mesh Generation from a Single Image with Sparse-view Large Reconstruction Models</b></a></h2> <h2>InstantMesh:2D图片到3D模型转化工具,单张图片仅需10秒即可生成高质量3D模型</h2>
**InstantMesh** is a feed-forward framework for efficient 3D mesh generation from a single image based on the LRM/Instant3D architecture. ❗️❗️❗️**注意:**
- 3D模型生成结果在很大程度上取决于生成的多视图图像的质量。如果结果不能令您满意,请尝试其他**seed value**(默认:42)
Code: <a href='https://github.com/TencentARC/InstantMesh' target='_blank'>GitHub</a>. Techenical report: <a href='https://arxiv.org/abs/2404.07191' target='_blank'>ArXiv</a>.
❗️❗️❗️**Important Notes:**
- Our demo can export a .obj mesh with vertex colors or a .glb mesh now. If you prefer to export a .obj mesh with a **texture map**, please refer to our <a href='https://github.com/TencentARC/InstantMesh?tab=readme-ov-file#running-with-command-line' target='_blank'>Github Repo</a>.
- The 3D mesh generation results highly depend on the quality of generated multi-view images. Please try a different **seed value** if the result is unsatisfying (Default: 42).
''' '''
_CITE_ = r"""
If InstantMesh is helpful, please help to ⭐ the <a href='https://github.com/TencentARC/InstantMesh' target='_blank'>Github Repo</a>. Thanks! [![GitHub Stars](https://img.shields.io/github/stars/TencentARC/InstantMesh?style=social)](https://github.com/TencentARC/InstantMesh)
---
📝 **Citation**
If you find our work useful for your research or applications, please cite using this bibtex:
```bibtex
@article{xu2024instantmesh,
title={InstantMesh: Efficient 3D Mesh Generation from a Single Image with Sparse-view Large Reconstruction Models},
author={Xu, Jiale and Cheng, Weihao and Gao, Yiming and Wang, Xintao and Gao, Shenghua and Shan, Ying},
journal={arXiv preprint arXiv:2404.07191},
year={2024}
}
```
📋 **License**
Apache-2.0 LICENSE. Please refer to the [LICENSE file](https://huggingface.co/spaces/TencentARC/InstantMesh/blob/main/LICENSE) for details.
📧 **Contact**
If you have any questions, feel free to open a discussion or contact us at <b>bluestyle928@gmail.com</b>.
"""
with gr.Blocks() as demo: with gr.Blocks() as demo:
gr.Markdown(_HEADER_) gr.Markdown(_HEADER_)
...@@ -269,7 +241,7 @@ with gr.Blocks() as demo: ...@@ -269,7 +241,7 @@ with gr.Blocks() as demo:
with gr.Column(): with gr.Column():
with gr.Row(): with gr.Row():
input_image = gr.Image( input_image = gr.Image(
label="Input Image", label="输入图像",
image_mode="RGBA", image_mode="RGBA",
sources="upload", sources="upload",
width=256, width=256,
...@@ -278,7 +250,7 @@ with gr.Blocks() as demo: ...@@ -278,7 +250,7 @@ with gr.Blocks() as demo:
elem_id="content_image", elem_id="content_image",
) )
processed_image = gr.Image( processed_image = gr.Image(
label="Processed Image", label="输出图像",
image_mode="RGBA", image_mode="RGBA",
width=256, width=256,
height=256, height=256,
...@@ -288,7 +260,7 @@ with gr.Blocks() as demo: ...@@ -288,7 +260,7 @@ with gr.Blocks() as demo:
with gr.Row(): with gr.Row():
with gr.Group(): with gr.Group():
do_remove_background = gr.Checkbox( do_remove_background = gr.Checkbox(
label="Remove Background", value=True label="删除背景", value=True
) )
sample_seed = gr.Number(value=42, label="Seed Value", precision=0) sample_seed = gr.Number(value=42, label="Seed Value", precision=0)
...@@ -301,7 +273,7 @@ with gr.Blocks() as demo: ...@@ -301,7 +273,7 @@ with gr.Blocks() as demo:
) )
with gr.Row(): with gr.Row():
submit = gr.Button("Generate", elem_id="generate", variant="primary") submit = gr.Button("生成", elem_id="generate", variant="primary")
with gr.Row(variant="panel"): with gr.Row(variant="panel"):
gr.Examples( gr.Examples(
...@@ -317,7 +289,7 @@ with gr.Blocks() as demo: ...@@ -317,7 +289,7 @@ with gr.Blocks() as demo:
with gr.Row(): with gr.Row():
with gr.Column(): with gr.Column():
mv_show_images = gr.Image( mv_show_images = gr.Image(
label="Generated Multi-views", label="生成的多视图",
type="pil", type="pil",
width=379, width=379,
interactive=False interactive=False
...@@ -325,7 +297,7 @@ with gr.Blocks() as demo: ...@@ -325,7 +297,7 @@ with gr.Blocks() as demo:
with gr.Column(): with gr.Column():
output_video = gr.Video( output_video = gr.Video(
label="video", format="mp4", label="视频", format="mp4",
width=379, width=379,
autoplay=True, autoplay=True,
interactive=False interactive=False
...@@ -334,24 +306,24 @@ with gr.Blocks() as demo: ...@@ -334,24 +306,24 @@ with gr.Blocks() as demo:
with gr.Row(): with gr.Row():
with gr.Tab("OBJ"): with gr.Tab("OBJ"):
output_model_obj = gr.Model3D( output_model_obj = gr.Model3D(
label="Output Model (OBJ Format)", label="输出模型 (OBJ Format)",
# width=768, # width=768,
interactive=False, interactive=False,
) )
gr.Markdown( gr.Markdown(
"Note: Downloaded .obj model will be flipped. Export .glb instead or manually flip it before usage.") "注意:下载的.obj模型将被翻转。改为导出.glb或在使用前手动翻转它")
with gr.Tab("GLB"): with gr.Tab("GLB"):
output_model_glb = gr.Model3D( output_model_glb = gr.Model3D(
label="Output Model (GLB Format)", label="输出模型 (GLB Format)",
# width=768, # width=768,
interactive=False, interactive=False,
) )
gr.Markdown("Note: The model shown here has a darker appearance. Download to get correct results.") gr.Markdown("注意:此处显示的模型外观较暗。下载以获得正确的结果")
with gr.Row(): with gr.Row():
gr.Markdown('''Try a different <b>seed value</b> if the result is unsatisfying (Default: 42).''') gr.Markdown('''如果结果不能令您满意,请尝试其他**seed value**(默认:42)''')
gr.Markdown(_CITE_)
mv_images = gr.State() mv_images = gr.State()
submit.click(fn=check_input_image, inputs=[input_image]).success( submit.click(fn=check_input_image, inputs=[input_image]).success(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment