neverix commited on
Commit
0b42751
1 Parent(s): a627180

Try to force reboot

Browse files
Files changed (1) hide show
  1. app.py +44 -41
app.py CHANGED
@@ -26,47 +26,50 @@ def generate(*args):
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
 
26
  return [video_path, model_path]
27
 
28
 
29
+ def main():
30
+ with gr.Blocks() as ui:
31
+ gr.Markdown("# Pulsar+CLIP")
32
+ gr.Markdown("Generate 3D point clouds from text!")
33
+
34
+ with gr.Group():
35
+ gr.Markdown("## Settings")
36
+ inputs = []
37
+ defaults = []
38
+ with gr.Tabs():
39
+ for name, section in CONFIG_SPEC:
40
+ with gr.TabItem(name):
41
+ for k, v0, t in section:
42
+ if t in (float, int):
43
+ element = gr.Number(label=k, value=v0)
44
+ elif t == str:
45
+ element = gr.Textbox(label=k, value=v0)
46
+ elif t == bool:
47
+ element = gr.Checkbox(label=k, value=v0)
48
+ elif isinstance(t, tuple):
49
+ element = gr.Slider(*t, label=k, value=v0)
50
+ elif isinstance(t, list):
51
+ element = gr.Dropdown(label=k, value=v0, choices=t)
52
+ else:
53
+ raise TypeError(f"Input format {t} should be one of str, int, bool, tuple, list")
54
+ element = 1/0
55
+ inputs.append(element)
56
+ defaults.append(v0)
57
+
58
+ button = gr.Button("Run")
59
+ gr.Markdown("## Result")
60
+ with gr.Row():
61
+ with gr.Column():
62
+ video = gr.Video()
63
+ with gr.Column():
64
+ model = gr.Model3D()
65
+
66
+ button.click(fn=generate, inputs=inputs, outputs=[video, model])
67
+
68
+ gr.Markdown("## Examples")
69
+ gr.Examples(fn=generate, inputs=inputs, outputs=[video, model],
70
+ examples=[defaults], cache_examples=True, examples_per_page=1)
71
+ return ui
72
 
73
+ ui = main()
74
  ui.launch()
75
  demo = ui