Update app.py
Browse files
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 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
|
| 46 |
# button settings and event handlers remain the same
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
|
| 57 |
-
|
| 58 |
|
| 59 |
# Event handler and button settings remain unchanged
|
| 60 |
|
| 61 |
-
|
| 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()
|