neverix commited on
Commit
a627180
·
1 Parent(s): 0838154

Temporary patch before tomorrow

Browse files
Files changed (1) hide show
  1. app.py +43 -51
app.py CHANGED
@@ -22,59 +22,51 @@ def generate(*args):
22
  im.save(p.stdin, "PNG")
23
  p.stdin.close()
24
  p.wait()
25
- return video_path
 
26
 
27
 
28
- def main():
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
- 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
- ui.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
- #gr.Interface(inputs=[
73
- #(gr.inputs.Number(label=k, default=v0) if t in (float, int) else
74
- #gr.inputs.Checkbox(label=k, default=v0) if t == bool else gr.inputs.Textbox(label=k, default=v0) if t == str
75
- #else gr.inputs.Dropdown(label=k, default=v0, choices=t) if isinstance(t, (tuple, list)) else 1/0)
76
- #for k, v0, t in CONFIG_SPEC], outputs=gr.outputs.Video(), fn=generate).launch()
77
-
 
 
 
 
 
 
 
78
 
79
- if __name__ == '__main__':
80
- main()
 
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