jhj0517 commited on
Commit
99ea33b
·
1 Parent(s): 919d069

Add video tab

Browse files
Files changed (1) hide show
  1. app.py +57 -35
app.py CHANGED
@@ -49,41 +49,63 @@ class App:
49
  with self.i18n:
50
  gr.Markdown(REPO_MARKDOWN, elem_id="md_project")
51
 
52
- with gr.Row():
53
- with gr.Column():
54
- img_ref = gr.Image(label=_("Reference Image"))
55
- with gr.Row():
56
- btn_gen = gr.Button("GENERATE", visible=False)
57
- with gr.Row(equal_height=True):
58
- with gr.Column(scale=9):
59
- img_out = gr.Image(label=_("Output Image"))
60
- with gr.Column(scale=1):
61
- expression_parameters = self.create_parameters()
62
- btn_openfolder = gr.Button('📂')
63
- with gr.Accordion("Opt in features", visible=False):
64
- img_sample = gr.Image()
65
- img_motion_link = gr.Image()
66
- tb_exp = gr.Textbox()
67
-
68
- params = expression_parameters + [img_ref]
69
- opt_in_features_params = [img_sample, img_motion_link, tb_exp]
70
-
71
- gr.on(
72
- triggers=[param.change for param in params],
73
- fn=self.inferencer.edit_expression,
74
- inputs=params + opt_in_features_params,
75
- outputs=img_out,
76
- show_progress="minimal",
77
- queue=True
78
- )
79
-
80
- btn_openfolder.click(
81
- fn=lambda: self.open_folder(self.args.output_dir), inputs=None, outputs=None
82
- )
83
-
84
- btn_gen.click(self.inferencer.edit_expression,
85
- inputs=params + opt_in_features_params,
86
- outputs=img_out)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
  gradio_launch_args = {
89
  "inbrowser": self.args.inbrowser,
 
49
  with self.i18n:
50
  gr.Markdown(REPO_MARKDOWN, elem_id="md_project")
51
 
52
+ with gr.Tabs():
53
+ with gr.TabItem(_("Expression Editing")):
54
+ with gr.Row():
55
+ with gr.Column():
56
+ img_ref = gr.Image(label=_("Reference Image"))
57
+ with gr.Row():
58
+ btn_gen = gr.Button("GENERATE", visible=False)
59
+ with gr.Row(equal_height=True):
60
+ with gr.Column(scale=9):
61
+ img_out = gr.Image(label=_("Output Image"))
62
+ with gr.Column(scale=1):
63
+ expression_parameters = self.create_parameters()
64
+ btn_openfolder = gr.Button('📂')
65
+ with gr.Accordion("Opt in features", visible=False):
66
+ img_sample = gr.Image()
67
+ img_motion_link = gr.Image()
68
+ tb_exp = gr.Textbox()
69
+
70
+ params = expression_parameters + [img_ref]
71
+ opt_in_features_params = [img_sample, img_motion_link, tb_exp]
72
+
73
+ gr.on(
74
+ triggers=[param.change for param in params],
75
+ fn=self.inferencer.edit_expression,
76
+ inputs=params + opt_in_features_params,
77
+ outputs=img_out,
78
+ show_progress="minimal",
79
+ queue=True
80
+ )
81
+
82
+ btn_openfolder.click(
83
+ fn=lambda: self.open_folder(self.args.output_dir), inputs=None, outputs=None
84
+ )
85
+
86
+ btn_gen.click(self.inferencer.edit_expression,
87
+ inputs=params + opt_in_features_params,
88
+ outputs=img_out)
89
+
90
+ with gr.TabItem(_("Video Driven")):
91
+ with gr.Row():
92
+ img_ref = gr.Image(label=_("Reference Image"))
93
+ vid_driven = gr.Video(label=_("Driven Video"))
94
+ dd_model_type = gr.Dropdown(label=_("Model Type"), visible=False, interactive=False,
95
+ choices=[item.value for item in ModelType],
96
+ value=ModelType.HUMAN.value),
97
+ with gr.Row():
98
+ btn_gen = gr.Button(_("GENERATE"))
99
+ with gr.Row(equal_height=True):
100
+ with gr.Column(scale=9):
101
+ vid_out = gr.Video(label=_("Output Video"), scale=9)
102
+ with gr.Column(scale=1):
103
+ btn_openfolder = gr.Button('📂')
104
+
105
+ btn_gen.click(
106
+ fn=self.inferencer.create_video,
107
+
108
+ )
109
 
110
  gradio_launch_args = {
111
  "inbrowser": self.args.inbrowser,