File size: 813 Bytes
5fc6e77
cbae235
5fc6e77
 
 
e69beaf
b9c6c2f
e69beaf
ccb6c0d
e69beaf
 
ccb6c0d
b4c9c8b
b9c6c2f
 
 
 
bc68a95
b9c6c2f
ab1ee56
b9c6c2f
cbae235
7af0786
66edb16
bf6704c
 
5fc6e77
 
ab1ee56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import gradio as gr
import groovy as gv
from flow import flow

with gr.Blocks() as app:
    task_box = gr.Textbox(label="🕺 Task", value="flow.task")
    with gr.Row():
        if flow.inputs:
            with gr.Column(scale=1):
                for component in flow.inputs:
                    component.render()
        with gr.Column(scale=2):
            gr.Image(label="Recording", value="recording.gif")

    @gr.on(
        triggers=[app.load] + [input.change for input in flow.inputs],
        inputs=flow.inputs,
        outputs=[task_box],
        trigger_mode="always_last",
        show_api=False
    )
    def construct_prompt(*input_values):
        return flow.task.format(*input_values)

    gr.api(lambda : flow.to_json(), api_name="flow_config")


if __name__ == "__main__":
    app.launch()