Spaces:
Build error
Build error
neverix
commited on
Commit
·
a627180
1
Parent(s):
0838154
Temporary patch before tomorrow
Browse files
app.py
CHANGED
@@ -22,59 +22,51 @@ def generate(*args):
|
|
22 |
im.save(p.stdin, "PNG")
|
23 |
p.stdin.close()
|
24 |
p.wait()
|
25 |
-
|
|
|
26 |
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
gr.Markdown("Generate 3D point clouds from text!")
|
32 |
-
|
33 |
-
with gr.Group():
|
34 |
-
gr.Markdown("## Settings")
|
35 |
-
inputs = []
|
36 |
-
defaults = []
|
37 |
-
with gr.Tabs():
|
38 |
-
for name, section in CONFIG_SPEC:
|
39 |
-
with gr.TabItem(name):
|
40 |
-
for k, v0, t in section:
|
41 |
-
if t in (float, int):
|
42 |
-
element = gr.Number(label=k, value=v0)
|
43 |
-
elif t == str:
|
44 |
-
element = gr.Textbox(label=k, value=v0)
|
45 |
-
elif t == bool:
|
46 |
-
element = gr.Checkbox(label=k, value=v0)
|
47 |
-
elif isinstance(t, tuple):
|
48 |
-
element = gr.Slider(*t, label=k, value=v0)
|
49 |
-
elif isinstance(t, list):
|
50 |
-
element = gr.Dropdown(label=k, value=v0, choices=t)
|
51 |
-
else:
|
52 |
-
raise TypeError(f"Input format {t} should be one of str, int, bool, tuple, list")
|
53 |
-
element = 1/0
|
54 |
-
inputs.append(element)
|
55 |
-
defaults.append(v0)
|
56 |
-
|
57 |
-
with gr.Row():
|
58 |
-
with gr.Column():
|
59 |
-
button = gr.Button("Run")
|
60 |
-
gr.Markdown("## Result")
|
61 |
-
output = gr.Video()
|
62 |
-
|
63 |
-
button.click(fn=generate, inputs=inputs, outputs=output)
|
64 |
-
|
65 |
-
with gr.Column():
|
66 |
-
gr.Markdown("## Examples")
|
67 |
-
gr.Examples(fn=generate, inputs=inputs, outputs=output,
|
68 |
-
examples=[defaults])
|
69 |
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
|
80 |
-
|
|
|
22 |
im.save(p.stdin, "PNG")
|
23 |
p.stdin.close()
|
24 |
p.wait()
|
25 |
+
model_path = None # TODO
|
26 |
+
return [video_path, model_path]
|
27 |
|
28 |
|
29 |
+
with gr.Blocks() as ui:
|
30 |
+
gr.Markdown("# Pulsar+CLIP")
|
31 |
+
gr.Markdown("Generate 3D point clouds from text!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
with gr.Group():
|
34 |
+
gr.Markdown("## Settings")
|
35 |
+
inputs = []
|
36 |
+
defaults = []
|
37 |
+
with gr.Tabs():
|
38 |
+
for name, section in CONFIG_SPEC:
|
39 |
+
with gr.TabItem(name):
|
40 |
+
for k, v0, t in section:
|
41 |
+
if t in (float, int):
|
42 |
+
element = gr.Number(label=k, value=v0)
|
43 |
+
elif t == str:
|
44 |
+
element = gr.Textbox(label=k, value=v0)
|
45 |
+
elif t == bool:
|
46 |
+
element = gr.Checkbox(label=k, value=v0)
|
47 |
+
elif isinstance(t, tuple):
|
48 |
+
element = gr.Slider(*t, label=k, value=v0)
|
49 |
+
elif isinstance(t, list):
|
50 |
+
element = gr.Dropdown(label=k, value=v0, choices=t)
|
51 |
+
else:
|
52 |
+
raise TypeError(f"Input format {t} should be one of str, int, bool, tuple, list")
|
53 |
+
element = 1/0
|
54 |
+
inputs.append(element)
|
55 |
+
defaults.append(v0)
|
56 |
|
57 |
+
button = gr.Button("Run")
|
58 |
+
gr.Markdown("## Result")
|
59 |
+
with gr.Row():
|
60 |
+
with gr.Column():
|
61 |
+
video = gr.Video()
|
62 |
+
with gr.Column():
|
63 |
+
model = gr.Model3D()
|
64 |
+
|
65 |
+
button.click(fn=generate, inputs=inputs, outputs=[video, model])
|
66 |
+
|
67 |
+
gr.Markdown("## Examples")
|
68 |
+
gr.Examples(fn=generate, inputs=inputs, outputs=[video, model],
|
69 |
+
examples=[defaults], cache_examples=True, examples_per_page=1)
|
70 |
|
71 |
+
ui.launch()
|
72 |
+
demo = ui
|