Spaces:
Build error
Build error
neverix
commited on
Commit
•
0838154
1
Parent(s):
4b0990a
Bad interface I'm keeping
Browse files
app.py
CHANGED
@@ -4,8 +4,10 @@ import gradio as gr
|
|
4 |
|
5 |
|
6 |
def generate(*args):
|
7 |
-
pc = PulsarCLIP(dict([(k, t(v) if not isinstance(t, (tuple, list))
|
8 |
-
|
|
|
|
|
9 |
frames = []
|
10 |
for image in pc.generate():
|
11 |
frames.append(image)
|
@@ -31,6 +33,7 @@ def main():
|
|
31 |
with gr.Group():
|
32 |
gr.Markdown("## Settings")
|
33 |
inputs = []
|
|
|
34 |
with gr.Tabs():
|
35 |
for name, section in CONFIG_SPEC:
|
36 |
with gr.TabItem(name):
|
@@ -49,13 +52,20 @@ def main():
|
|
49 |
raise TypeError(f"Input format {t} should be one of str, int, bool, tuple, list")
|
50 |
element = 1/0
|
51 |
inputs.append(element)
|
52 |
-
|
53 |
-
gr.Markdown("## Result")
|
54 |
-
output = gr.Video()
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
ui.launch()
|
61 |
|
|
|
4 |
|
5 |
|
6 |
def generate(*args):
|
7 |
+
pc = PulsarCLIP(dict([(k, t(v) if not isinstance(t, (tuple, list))
|
8 |
+
else (type(t[0])(v) if isinstance(t, tuple) else v))
|
9 |
+
for v, (k, v0, t) in zip(args,
|
10 |
+
(y for _, x in CONFIG_SPEC for y in x))]))
|
11 |
frames = []
|
12 |
for image in pc.generate():
|
13 |
frames.append(image)
|
|
|
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):
|
|
|
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 |
|