jhj0517 commited on
Commit
9fa70f5
·
1 Parent(s): fee04a0

Update video UI

Browse files
Files changed (1) hide show
  1. app.py +25 -6
app.py CHANGED
@@ -20,7 +20,7 @@ class App:
20
  )
21
 
22
  @staticmethod
23
- def create_parameters():
24
  return [
25
  gr.Dropdown(label=_("Model Type"), visible=False, interactive=False,
26
  choices=[item.value for item in ModelType], value=ModelType.HUMAN.value),
@@ -44,6 +44,19 @@ class App:
44
  gr.Slider(label=_("Crop Factor"), minimum=1.5, maximum=2.5, step=0.1, value=1.7)
45
  ]
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  def launch(self):
48
  with self.app:
49
  with self.i18n:
@@ -60,7 +73,7 @@ class App:
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()
@@ -91,9 +104,9 @@ class App:
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):
@@ -102,9 +115,15 @@ class App:
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 = {
 
20
  )
21
 
22
  @staticmethod
23
+ def create_expression_parameters():
24
  return [
25
  gr.Dropdown(label=_("Model Type"), visible=False, interactive=False,
26
  choices=[item.value for item in ModelType], value=ModelType.HUMAN.value),
 
44
  gr.Slider(label=_("Crop Factor"), minimum=1.5, maximum=2.5, step=0.1, value=1.7)
45
  ]
46
 
47
+ @staticmethod
48
+ def create_video_parameters():
49
+ return [
50
+ gr.Dropdown(label=_("Model Type"), visible=False, interactive=False,
51
+ choices=[item.value for item in ModelType],
52
+ value=ModelType.HUMAN.value),
53
+ gr.Slider(label=_("Retargeting Eyes"), minimum=0, maximum=1, step=0.01, value=0),
54
+ gr.Slider(label=_("Retargeting Mouth"), minimum=0, maximum=1, step=0.01, value=0),
55
+ gr.Checkbox(label=_("Tracking Source Video"), value=False, visible=False),
56
+ gr.Checkbox(label=_("Animate Without Video"), value=False, visible=False),
57
+ gr.Slider(label=_("Crop Factor"), minimum=1.5, maximum=2.5, step=0.1, value=1.7),
58
+ ]
59
+
60
  def launch(self):
61
  with self.app:
62
  with self.i18n:
 
73
  with gr.Column(scale=9):
74
  img_out = gr.Image(label=_("Output Image"))
75
  with gr.Column(scale=1):
76
+ expression_parameters = self.create_expression_parameters()
77
  btn_openfolder = gr.Button('📂')
78
  with gr.Accordion("Opt in features", visible=False):
79
  img_sample = gr.Image()
 
104
  with gr.Row():
105
  img_ref = gr.Image(label=_("Reference Image"))
106
  vid_driven = gr.Video(label=_("Driven Video"))
107
+ with gr.Column():
108
+ vid_params = self.create_video_parameters()
109
+
110
  with gr.Row():
111
  btn_gen = gr.Button(_("GENERATE"))
112
  with gr.Row(equal_height=True):
 
115
  with gr.Column(scale=1):
116
  btn_openfolder = gr.Button('📂')
117
 
118
+ params = vid_params + [img_ref, vid_driven]
119
+
120
  btn_gen.click(
121
  fn=self.inferencer.create_video,
122
+ inputs=params,
123
+ outputs=vid_out
124
+ )
125
+ btn_openfolder.click(
126
+ fn=lambda: self.open_folder(self.args.output_dir), inputs=None, outputs=None
127
  )
128
 
129
  gradio_launch_args = {