jhj0517
commited on
Commit
·
99ea33b
1
Parent(s):
919d069
Add video tab
Browse files
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.
|
53 |
-
with gr.
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|