abidlabs HF Staff commited on
Commit
b9e5784
·
verified ·
1 Parent(s): 225c549

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import groovy as gv
3
+ from flow import flow
4
+
5
+ with gr.Blocks() as app:
6
+ task_box = gr.Textbox(label="🕺 Task", value="flow.task" info="Run this workflow locally by installing the [Groovy Python package](https://github.com/abidlabs/groovy) and then running `groovy run https://huggingface.co/space/url>`.)
7
+ with gr.Row():
8
+ if flow.inputs:
9
+ with gr.Column(scale=1):
10
+ for component in flow.inputs:
11
+ component.render()
12
+ with gr.Column(scale=2):
13
+ gr.Image(label="Recording", value="../../.groovy/recording.gif")
14
+ config = gr.JSON(visible=False)
15
+
16
+ @gr.on(
17
+ triggers=[app.load] + [input.change for input in flow.inputs],
18
+ inputs=flow.inputs,
19
+ outputs=[task_box],
20
+ trigger_mode="always_last",
21
+ show_api=False
22
+ )
23
+ def construct_prompt(*input_values):
24
+ return flow.task.format(*input_values)
25
+
26
+ app.load(flow.to_json, None, config, api_name="flow_config")
27
+
28
+
29
+ if __name__ == "__main__":
30
+ app.launch()