Spaces:
Running
on
Zero
Running
on
Zero
优化界面和交互
Browse files
app.py
CHANGED
|
@@ -1,16 +1,33 @@
|
|
| 1 |
import spaces
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
-
title = "## Image to 3D"
|
| 5 |
-
description = "Image to 3D"
|
| 6 |
|
| 7 |
@spaces.GPU(duration=60)
|
| 8 |
def gen_shape():
|
| 9 |
print("do nothing")
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
with gr.Blocks().queue() as demo:
|
| 13 |
gr.Markdown(title)
|
| 14 |
gr.Markdown(description)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
demo.launch()
|
|
|
|
| 1 |
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
+
from glob import glob
|
| 4 |
|
|
|
|
|
|
|
| 5 |
|
| 6 |
@spaces.GPU(duration=60)
|
| 7 |
def gen_shape():
|
| 8 |
print("do nothing")
|
| 9 |
|
| 10 |
+
def get_example_img_list():
|
| 11 |
+
print('Loading 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 |
|
| 18 |
with gr.Blocks().queue() as demo:
|
| 19 |
gr.Markdown(title)
|
| 20 |
gr.Markdown(description)
|
| 21 |
+
with gr.Row():
|
| 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],
|
| 30 |
+
label=None, examples_per_page=18)
|
| 31 |
+
|
| 32 |
|
| 33 |
demo.launch()
|