fffiloni commited on
Commit
14c57e1
·
verified ·
1 Parent(s): 396116c

Update gradio/vace.py

Browse files
Files changed (1) hide show
  1. gradio/vace.py +23 -11
gradio/vace.py CHANGED
@@ -17,6 +17,8 @@ snapshot_download(
17
  local_dir = "./models/Wan2.1-VACE-1.3B"
18
  )
19
 
 
 
20
  sys.path.insert(0, os.path.sep.join(os.path.realpath(__file__).split(os.path.sep)[:-2]))
21
  import wan
22
  from wan import WanVace, WanVaceMP
@@ -65,11 +67,21 @@ class VACEInference:
65
 
66
 
67
  def create_ui(self, *args, **kwargs):
68
- gr.Markdown("""
69
- <div style="text-align: center; font-size: 24px; font-weight: bold; margin-bottom: 15px;">
70
- <a href="https://ali-vilab.github.io/VACE-Page/" style="text-decoration: none; color: inherit;">VACE-WAN Demo</a>
71
- </div>
72
- """)
 
 
 
 
 
 
 
 
 
 
73
  with gr.Row(variant='panel', equal_height=True):
74
  with gr.Column(scale=1, min_width=0):
75
  self.src_video = gr.Video(
@@ -150,7 +162,7 @@ class VACEInference:
150
  maximum=100,
151
  step=1,
152
  value=25,
153
- interactive=True)
154
  self.context_scale = gr.Slider(
155
  label='context_scale',
156
  minimum=0.0,
@@ -174,13 +186,13 @@ class VACEInference:
174
  with gr.Row(equal_height=True):
175
  self.output_height = gr.Textbox(
176
  label='resolutions_height',
177
- # value=480,
178
- value=720,
179
  interactive=True)
180
  self.output_width = gr.Textbox(
181
  label='resolutions_width',
182
- # value=832,
183
- value=1280,
184
  interactive=True)
185
  self.frame_rate = gr.Textbox(
186
  label='frame_rate',
@@ -269,7 +281,7 @@ if __name__ == '__main__':
269
  parser.add_argument('--root_path', dest='root_path', help='', default=None)
270
  parser.add_argument('--save_dir', dest='save_dir', help='', default='cache')
271
  parser.add_argument("--mp", action="store_true", help="Use Multi-GPUs",)
272
- parser.add_argument("--model_name", type=str, default="vace-14B", choices=list(WAN_CONFIGS.keys()), help="The model name to run.")
273
  parser.add_argument("--ulysses_size", type=int, default=1, help="The size of the ulysses parallelism in DiT.")
274
  parser.add_argument("--ring_size", type=int, default=1, help="The size of the ring attention parallelism in DiT.")
275
  parser.add_argument(
 
17
  local_dir = "./models/Wan2.1-VACE-1.3B"
18
  )
19
 
20
+ is_shared_ui = True if "fffiloni/Wan2.1-VACE-1.3B" in os.environ['SPACE_ID'] else False
21
+
22
  sys.path.insert(0, os.path.sep.join(os.path.realpath(__file__).split(os.path.sep)[:-2]))
23
  import wan
24
  from wan import WanVace, WanVaceMP
 
67
 
68
 
69
  def create_ui(self, *args, **kwargs):
70
+
71
+ gr.Markdown("# VACE-WAN 1.3B Demo")
72
+ gr.Markdown("All-in-One Video Creation and Editing")
73
+
74
+ gr.HTML("""
75
+ <div style="display:flex;column-gap:4px;">
76
+ <a href="https://ali-vilab.github.io/VACE-Page/">
77
+ <img src='https://img.shields.io/badge/Project-Page-green'>
78
+ </a>
79
+
80
+ <a href="https://huggingface.co/spaces/fffiloni/Wan2.1-VACE-1.3B?duplicate=true">
81
+ <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-sm.svg" alt="Duplicate this Space">
82
+ </a>
83
+ </div>
84
+ """)
85
  with gr.Row(variant='panel', equal_height=True):
86
  with gr.Column(scale=1, min_width=0):
87
  self.src_video = gr.Video(
 
162
  maximum=100,
163
  step=1,
164
  value=25,
165
+ interactive=False if is_shared_ui else True)
166
  self.context_scale = gr.Slider(
167
  label='context_scale',
168
  minimum=0.0,
 
186
  with gr.Row(equal_height=True):
187
  self.output_height = gr.Textbox(
188
  label='resolutions_height',
189
+ value=480,
190
+ #value=720,
191
  interactive=True)
192
  self.output_width = gr.Textbox(
193
  label='resolutions_width',
194
+ value=832,
195
+ #value=1280,
196
  interactive=True)
197
  self.frame_rate = gr.Textbox(
198
  label='frame_rate',
 
281
  parser.add_argument('--root_path', dest='root_path', help='', default=None)
282
  parser.add_argument('--save_dir', dest='save_dir', help='', default='cache')
283
  parser.add_argument("--mp", action="store_true", help="Use Multi-GPUs",)
284
+ parser.add_argument("--model_name", type=str, default="vace-1.3B", choices=list(WAN_CONFIGS.keys()), help="The model name to run.")
285
  parser.add_argument("--ulysses_size", type=int, default=1, help="The size of the ulysses parallelism in DiT.")
286
  parser.add_argument("--ring_size", type=int, default=1, help="The size of the ring attention parallelism in DiT.")
287
  parser.add_argument(