fantaxy commited on
Commit
eb4a36b
1 Parent(s): 538c8ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -29
app.py CHANGED
@@ -23,45 +23,57 @@ class App:
23
 
24
  @staticmethod
25
  def on_step1_complete(input_img: str, input_pose_vid: str):
26
-
27
  return [gr.Image(label="Input Image", value=input_img, type="filepath", scale=5),
28
  gr.Video(label="Input Aligned Pose Video", value=input_pose_vid, scale=5)]
29
 
30
- def musepose_demo(self):
31
- with gr.Blocks() as demo:
32
- md_header = self.header()
33
- with gr.Tabs():
34
- with gr.TabItem('1: Pose Alignment'):
35
- with gr.Row():
36
- with gr.Column(scale=3):
37
- img_pose_input = gr.Image(label="Input Image", type="filepath", scale=5)
38
- vid_dance_input = gr.Video(label="Input Dance Video", max_length=10, scale=5) # Changed max_length to 10
39
- with gr.Column(scale=3):
40
- vid_dance_output = gr.Video(label="Aligned Pose Output", scale=5, interactive=False)
41
- vid_dance_output_demo = gr.Video(label="Aligned Pose Output Demo", scale=5)
42
- # rest of the column setup remains the same
43
- with gr.Column(scale=3):
44
- # column settings remain the same
45
 
46
  # button settings and event handlers remain the same
47
 
48
- with gr.TabItem('2: MusePose Inference'):
49
- with gr.Row():
50
- with gr.Column(scale=3):
51
- img_musepose_input = gr.Image(label="Input Image", type="filepath", scale=5)
52
- vid_pose_input = gr.Video(label="Input Aligned Pose Video", max_length=10, scale=5) # Changed max_length to 10
53
- with gr.Column(scale=3):
54
- vid_output = gr.Video(label="MusePose Output", scale=5)
55
- vid_output_demo = gr.Video(label="MusePose Output Demo", scale=5)
56
 
57
- # rest of the settings remains the same
58
 
59
  # Event handler and button settings remain unchanged
60
 
61
- return demo
62
-
63
- @staticmethod
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  def launch(self):
67
  demo = self.musepose_demo()
@@ -79,4 +91,4 @@ if __name__ == "__main__":
79
  args = parser.parse_args()
80
 
81
  app = App(args=args)
82
- app.launch()
 
23
 
24
  @staticmethod
25
  def on_step1_complete(input_img: str, input_pose_vid: str):
 
26
  return [gr.Image(label="Input Image", value=input_img, type="filepath", scale=5),
27
  gr.Video(label="Input Aligned Pose Video", value=input_pose_vid, scale=5)]
28
 
29
+ def musepose_demo(self):
30
+ with gr.Blocks() as demo:
31
+ md_header = self.header()
32
+ with gr.Tabs():
33
+ with gr.TabItem('1: Pose Alignment'):
34
+ with gr.Row():
35
+ with gr.Column(scale=3):
36
+ img_pose_input = gr.Image(label="Input Image", type="filepath", scale=5)
37
+ vid_dance_input = gr.Video(label="Input Dance Video", max_length=10, scale=5) # Changed max_length to 10
38
+ with gr.Column(scale=3):
39
+ vid_dance_output = gr.Video(label="Aligned Pose Output", scale=5, interactive=False)
40
+ vid_dance_output_demo = gr.Video(label="Aligned Pose Output Demo", scale=5)
41
+ # Rest of the column setup remains the same
42
+ with gr.Column(scale=3):
43
+ # column settings remain the same
44
 
45
  # button settings and event handlers remain the same
46
 
47
+ with gr.TabItem('2: MusePose Inference'):
48
+ with gr.Row():
49
+ with gr.Column(scale=3):
50
+ img_musepose_input = gr.Image(label="Input Image", type="filepath", scale=5)
51
+ vid_pose_input = gr.Video(label="Input Aligned Pose Video", max_length=10, scale=5) # Changed max_length to 10
52
+ with gr.Column(scale=3):
53
+ vid_output = gr.Video(label="MusePose Output", scale=5)
54
+ vid_output_demo = gr.Video(label="MusePose Output Demo", scale=5)
55
 
56
+ # Rest of the settings remains the same
57
 
58
  # Event handler and button settings remain unchanged
59
 
60
+ return demo
 
 
61
 
62
+ @staticmethod
63
+ def header():
64
+ header = gr.HTML(
65
+ """
66
+ <h1 style="font-size: 23px;">
67
+ <a href="https://github.com/jhj0517/MusePose-WebUI" target="_blank">MusePose WebUI</a>
68
+ </h1>
69
+ <p style="font-size: 18px;">
70
+ <strong>Note</strong>: This space now allows video input up to <strong>10 seconds</strong> because ZeroGPU limits the function runtime to 2 minutes. <br>
71
+ If you want longer video inputs, you have to run it locally. Click the link above and follow the README to try it locally.<br><br>
72
+ When you have completed the <strong>1: Pose Alignment</strong> process, go to <strong>2: MusePose Inference</strong> and click the "GENERATE" button.
73
+ </p>
74
+ """
75
+ )
76
+ return header
77
 
78
  def launch(self):
79
  demo = self.musepose_demo()
 
91
  args = parser.parse_args()
92
 
93
  app = App(args=args)
94
+ app.launch()