Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,11 +63,11 @@ args = tyro.cli(ArgumentConfig)
|
|
| 63 |
inference_cfg = partial_fields(InferenceConfig, args.__dict__) # use attribute of args to initial InferenceConfig
|
| 64 |
crop_cfg = partial_fields(CropConfig, args.__dict__) # use attribute of args to initial CropConfig
|
| 65 |
|
| 66 |
-
gradio_pipeline = GradioPipeline(
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
)
|
| 71 |
|
| 72 |
@spaces.GPU(duration=120)
|
| 73 |
def gpu_wrapped_execute_video(*args, **kwargs):
|
|
@@ -191,58 +191,77 @@ def run_end_to_end(image_path, text, voice, input_video, flag_relative, flag_do_
|
|
| 191 |
|
| 192 |
|
| 193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
gr.Markdown("# Text to LipSync")
|
| 199 |
-
with gr.Row():
|
| 200 |
-
script_txt = gr.Text()
|
| 201 |
-
voice = gr.Audio(label="์ฌ์ฉ์ ์์ฑ", type="filepath")
|
| 202 |
-
input_video = gr.Video()
|
| 203 |
-
|
| 204 |
-
with gr.Row():
|
| 205 |
-
image_input = gr.Image(type="filepath") # ์ฌ๊ธฐ์ image_input์ ์ ์ํฉ๋๋ค.
|
| 206 |
-
output_video.render()
|
| 207 |
-
#crop_output_video.render()
|
| 208 |
-
output_video_concat.render()
|
| 209 |
-
|
| 210 |
-
with gr.Row():
|
| 211 |
-
flag_relative_input = gr.Checkbox(value=True, label="relative motion")
|
| 212 |
-
flag_do_crop_input = gr.Checkbox(value=True, label="do crop")
|
| 213 |
-
flag_remap_input = gr.Checkbox(value=True, label="paste-back")
|
| 214 |
-
flag_crop_driving_video_input = gr.Checkbox(value=False, label="do crop (driving video)")
|
| 215 |
-
male = gr.Checkbox(value=False, label="male")
|
| 216 |
-
#animal = gr.Checkbox(value=False, label="animal") # animal ์ฒดํฌ๋ฐ์ค ์ถ๊ฐ
|
| 217 |
-
|
| 218 |
-
with gr.Row():
|
| 219 |
-
generate_speech = gr.Button("๐ Generate Speech", variant="primary")
|
| 220 |
-
|
| 221 |
-
generate_speech.click(
|
| 222 |
-
fn=run_end_to_end,
|
| 223 |
inputs=[
|
| 224 |
-
|
| 225 |
-
script_txt,
|
| 226 |
-
voice,
|
| 227 |
-
input_video,
|
| 228 |
-
flag_relative_input,
|
| 229 |
-
flag_do_crop_input,
|
| 230 |
-
flag_remap_input,
|
| 231 |
-
flag_crop_driving_video_input,
|
| 232 |
-
male,
|
| 233 |
-
#animal # ์ถ๊ฐ๋ animal ์
๋ ฅ
|
| 234 |
],
|
| 235 |
-
outputs=[
|
| 236 |
)
|
| 237 |
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
|
| 247 |
|
| 248 |
|
|
|
|
| 63 |
inference_cfg = partial_fields(InferenceConfig, args.__dict__) # use attribute of args to initial InferenceConfig
|
| 64 |
crop_cfg = partial_fields(CropConfig, args.__dict__) # use attribute of args to initial CropConfig
|
| 65 |
|
| 66 |
+
# gradio_pipeline = GradioPipeline(
|
| 67 |
+
# inference_cfg=inference_cfg,
|
| 68 |
+
# crop_cfg=crop_cfg,
|
| 69 |
+
# args=args
|
| 70 |
+
# )
|
| 71 |
|
| 72 |
@spaces.GPU(duration=120)
|
| 73 |
def gpu_wrapped_execute_video(*args, **kwargs):
|
|
|
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
+
|
| 195 |
+
###### ํ
์คํธ์ค ######
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
stf_pipeline = STFPipeline()
|
| 199 |
+
|
| 200 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 201 |
+
stf_button = gr.Button("stf test", variant="primary")
|
| 202 |
+
stf_button.click(
|
| 203 |
+
fn=gpu_wrapped_stf_pipeline_execute,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
inputs=[
|
| 205 |
+
audio_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
],
|
| 207 |
+
outputs=[driving_video_path]
|
| 208 |
)
|
| 209 |
|
| 210 |
+
###### ํ
์คํธ์ค ######
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
# with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 214 |
+
# with gr.Tabs():
|
| 215 |
+
# # ์ฒซ ๋ฒ์งธ ํญ: Text to LipSync
|
| 216 |
+
# with gr.Tab("Text to LipSync"):
|
| 217 |
+
# gr.Markdown("# Text to LipSync")
|
| 218 |
+
# with gr.Row():
|
| 219 |
+
# script_txt = gr.Text()
|
| 220 |
+
# voice = gr.Audio(label="์ฌ์ฉ์ ์์ฑ", type="filepath")
|
| 221 |
+
# input_video = gr.Video()
|
| 222 |
+
|
| 223 |
+
# with gr.Row():
|
| 224 |
+
# image_input = gr.Image(type="filepath") # ์ฌ๊ธฐ์ image_input์ ์ ์ํฉ๋๋ค.
|
| 225 |
+
# output_video.render()
|
| 226 |
+
# #crop_output_video.render()
|
| 227 |
+
# output_video_concat.render()
|
| 228 |
+
|
| 229 |
+
# with gr.Row():
|
| 230 |
+
# flag_relative_input = gr.Checkbox(value=True, label="relative motion")
|
| 231 |
+
# flag_do_crop_input = gr.Checkbox(value=True, label="do crop")
|
| 232 |
+
# flag_remap_input = gr.Checkbox(value=True, label="paste-back")
|
| 233 |
+
# flag_crop_driving_video_input = gr.Checkbox(value=False, label="do crop (driving video)")
|
| 234 |
+
# male = gr.Checkbox(value=False, label="male")
|
| 235 |
+
# #animal = gr.Checkbox(value=False, label="animal") # animal ์ฒดํฌ๋ฐ์ค ์ถ๊ฐ
|
| 236 |
+
|
| 237 |
+
# with gr.Row():
|
| 238 |
+
# generate_speech = gr.Button("๐ Generate Speech", variant="primary")
|
| 239 |
+
|
| 240 |
+
# generate_speech.click(
|
| 241 |
+
# fn=run_end_to_end,
|
| 242 |
+
# inputs=[
|
| 243 |
+
# image_input,
|
| 244 |
+
# script_txt,
|
| 245 |
+
# voice,
|
| 246 |
+
# input_video,
|
| 247 |
+
# flag_relative_input,
|
| 248 |
+
# flag_do_crop_input,
|
| 249 |
+
# flag_remap_input,
|
| 250 |
+
# flag_crop_driving_video_input,
|
| 251 |
+
# male,
|
| 252 |
+
# #animal # ์ถ๊ฐ๋ animal ์
๋ ฅ
|
| 253 |
+
# ],
|
| 254 |
+
# outputs=[output_video, output_video_concat]
|
| 255 |
+
# )
|
| 256 |
+
|
| 257 |
+
# # # ๋ ๋ฒ์งธ ํญ: FLUX ์ด๋ฏธ์ง ์์ฑ
|
| 258 |
+
# # with gr.Tab("FLUX ์ด๋ฏธ์ง ์์ฑ"):
|
| 259 |
+
# # flux_tab(image_input) # FLUX ์ด๋ฏธ์ง ์์ฑ์ ์ํ ๋ณ๋์ ํญ
|
| 260 |
|
| 261 |
+
# # # ์ธ ๋ฒ์งธ ํญ: Flux ๊ฐ๋ฐ์ฉ ํญ
|
| 262 |
+
# # with gr.Tab("FLUX Dev"):
|
| 263 |
+
# # flux_demo = create_flux_tab() # Flux ๊ฐ๋ฐ์ฉ ํญ ์์ฑ
|
| 264 |
+
# # #flux_demo.render() # ํด๋น UI๋ฅผ ๋ณ๋์ ํญ์๋ง ๋ ๋๋ง
|
| 265 |
|
| 266 |
|
| 267 |
|