Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ from elevenlabs_utils import ElevenLabsPipeline
|
|
22 |
from setup_environment import initialize_environment
|
23 |
from src.utils.video import extract_audio
|
24 |
#from flux_dev import create_flux_tab
|
25 |
-
|
26 |
# from diffusers import FluxPipeline
|
27 |
|
28 |
# import gdown
|
@@ -31,73 +31,7 @@ from src.utils.video import extract_audio
|
|
31 |
|
32 |
|
33 |
|
34 |
-
# #========================= # FLUX 모델 로드 설정
|
35 |
-
# flux_pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
|
36 |
-
# flux_pipe.enable_sequential_cpu_offload()
|
37 |
-
# flux_pipe.vae.enable_slicing()
|
38 |
-
# flux_pipe.vae.enable_tiling()
|
39 |
-
# flux_pipe.to(torch.float16)
|
40 |
|
41 |
-
|
42 |
-
# @spaces.GPU(duration=120)
|
43 |
-
# def generate_image(prompt, guidance_scale, width, height):
|
44 |
-
# # 이미지를 생성하는 함수
|
45 |
-
# output_image = flux_pipe(
|
46 |
-
# prompt=prompt,
|
47 |
-
# guidance_scale=guidance_scale,
|
48 |
-
# height=height,
|
49 |
-
# width=width,
|
50 |
-
# num_inference_steps=4,
|
51 |
-
# max_sequence_length=256,
|
52 |
-
# ).images[0]
|
53 |
-
|
54 |
-
# # 결과 폴더 생성
|
55 |
-
# result_folder = "/tmp/flux/"
|
56 |
-
# os.makedirs(result_folder, exist_ok=True)
|
57 |
-
|
58 |
-
# # 파일 이름 생성
|
59 |
-
# timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
|
60 |
-
# #filename = f"{prompt.replace(' ', '_')}_{timestamp}.png"
|
61 |
-
# filename = f"{'_'.join(prompt.split()[:3])}_{timestamp}.png"
|
62 |
-
# output_path = os.path.join(result_folder, filename)
|
63 |
-
|
64 |
-
# # # 이미지를 저장
|
65 |
-
# # output_image.save(output_path)
|
66 |
-
|
67 |
-
# return output_image, output_path # 두 개의 출력 반환
|
68 |
-
|
69 |
-
# def flux_tab(): #image_input): # image_input을 인자로 받습니다.
|
70 |
-
# with gr.Tab("FLUX 이미지 생성"):
|
71 |
-
# with gr.Row():
|
72 |
-
# with gr.Column():
|
73 |
-
# # 사용자 입력 설정
|
74 |
-
# prompt = gr.Textbox(label="Prompt", value="A cat holding a sign that says hello world")
|
75 |
-
# guidance_scale = gr.Slider(label="Guidance Scale", minimum=0.0, maximum=20.0, value=3.5, step=0.1)
|
76 |
-
# width = gr.Slider(label="Width", minimum=256, maximum=2048, value=512, step=64)
|
77 |
-
# height = gr.Slider(label="Height", minimum=256, maximum=2048, value=512, step=64)
|
78 |
-
|
79 |
-
# with gr.Column():
|
80 |
-
# # 출력 이미지와 다운로드 버튼
|
81 |
-
# output_image = gr.Image(type="pil", label="Output")
|
82 |
-
# download_button = gr.File(label="Download")
|
83 |
-
# generate_button = gr.Button("이미지 생성")
|
84 |
-
# #use_in_text2lipsync_button = gr.Button("이 이미지를 Text2Lipsync에서 사용하기") # 새로운 버튼 추가
|
85 |
-
|
86 |
-
# # 클릭 이벤트를 정의
|
87 |
-
# generate_button.click(
|
88 |
-
# fn=generate_image,
|
89 |
-
# inputs=[prompt, guidance_scale, width, height],
|
90 |
-
# outputs=[output_image, download_button]
|
91 |
-
# )
|
92 |
-
|
93 |
-
# # # 새로운 버튼 클릭 이벤트 정의
|
94 |
-
# # use_in_text2lipsync_button.click(
|
95 |
-
# # fn=lambda img: img, # 간단한 람다 함수를 사용하여 이미지를 그대로 전달
|
96 |
-
# # inputs=[output_image], # 생성된 이미지를 입력으로 사용
|
97 |
-
# # outputs=[image_input] # Text to LipSync 탭의 image_input을 업데이트
|
98 |
-
# # )
|
99 |
-
|
100 |
-
# #========================= # FLUX 모델 로드 설정
|
101 |
|
102 |
initialize_environment()
|
103 |
|
@@ -128,272 +62,271 @@ from stf_utils import STFPipeline
|
|
128 |
# audio_path="assets/examples/driving/test_aud.mp3"
|
129 |
#audio_path_component = gr.Textbox(label="Input", value="assets/examples/driving/test_aud.mp3")
|
130 |
|
131 |
-
@spaces.GPU(duration=120)
|
132 |
-
def gpu_wrapped_stf_pipeline_execute(audio_path):
|
133 |
-
|
134 |
|
135 |
|
136 |
-
###### 테스트중 ######
|
137 |
|
138 |
|
139 |
-
stf_pipeline = STFPipeline()
|
140 |
-
driving_video_path=gr.Video()
|
141 |
|
142 |
-
# set tyro theme
|
143 |
-
tyro.extras.set_accent_color("bright_cyan")
|
144 |
-
args = tyro.cli(ArgumentConfig)
|
145 |
|
146 |
-
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
|
160 |
-
|
161 |
-
|
162 |
|
163 |
-
###### 테스트중 ######
|
164 |
|
165 |
|
166 |
-
|
167 |
-
|
168 |
|
169 |
-
#
|
170 |
-
|
171 |
-
|
172 |
|
173 |
-
#
|
174 |
-
|
175 |
-
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
|
183 |
-
#
|
184 |
-
|
185 |
-
|
186 |
|
187 |
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
|
197 |
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
|
207 |
-
|
208 |
-
|
209 |
|
210 |
-
|
211 |
-
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
|
217 |
-
|
218 |
|
219 |
-
# def txt_to_driving_video(text):
|
220 |
-
# audio_path = gpu_wrapped_elevenlabs_pipeline_generate_voice(text)
|
221 |
-
# driving_video_path = gpu_wrapped_stf_pipeline_execute(audio_path)
|
222 |
-
# return driving_video_path
|
223 |
|
224 |
-
# # assets
|
225 |
-
# title_md = "assets/gradio_title.md"
|
226 |
-
# example_portrait_dir = "assets/examples/source"
|
227 |
-
# example_portrait_dir_custom = "assets/examples/source"
|
228 |
-
# example_video_dir = "assets/examples/driving"
|
229 |
-
# data_examples = [
|
230 |
-
# [osp.join(example_portrait_dir, "s9.jpg"), osp.join(example_video_dir, "d0.mp4"), True, True, True, True],
|
231 |
-
# [osp.join(example_portrait_dir, "s6.jpg"), osp.join(example_video_dir, "d0.mp4"), True, True, True, True],
|
232 |
-
# [osp.join(example_portrait_dir, "s10.jpg"), osp.join(example_video_dir, "d0.mp4"), True, True, True, True],
|
233 |
-
# [osp.join(example_portrait_dir, "s5.jpg"), osp.join(example_video_dir, "d18.mp4"), True, True, True, True],
|
234 |
-
# [osp.join(example_portrait_dir, "s7.jpg"), osp.join(example_video_dir, "d19.mp4"), True, True, True, True],
|
235 |
-
# [osp.join(example_portrait_dir, "s22.jpg"), osp.join(example_video_dir, "d0.mp4"), True, True, True, True],
|
236 |
-
# ]
|
237 |
-
# #################### interface logic ####################
|
238 |
|
239 |
-
#
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
|
248 |
-
#
|
249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
|
|
|
|
|
251 |
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
#
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
|
|
|
|
|
|
270 |
|
271 |
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
#
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
#
|
356 |
-
#
|
357 |
-
#
|
358 |
-
#
|
359 |
-
#
|
360 |
-
#
|
361 |
-
#
|
362 |
-
#
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
|
381 |
|
382 |
|
383 |
-
#
|
384 |
-
#
|
385 |
-
#
|
386 |
-
#
|
387 |
-
#
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
|
394 |
-
#
|
395 |
-
|
396 |
-
|
397 |
|
398 |
demo.launch(
|
399 |
server_port=args.server_port,
|
|
|
22 |
from setup_environment import initialize_environment
|
23 |
from src.utils.video import extract_audio
|
24 |
#from flux_dev import create_flux_tab
|
25 |
+
from flux_schnell import create_flux_tab
|
26 |
# from diffusers import FluxPipeline
|
27 |
|
28 |
# import gdown
|
|
|
31 |
|
32 |
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
initialize_environment()
|
37 |
|
|
|
62 |
# audio_path="assets/examples/driving/test_aud.mp3"
|
63 |
#audio_path_component = gr.Textbox(label="Input", value="assets/examples/driving/test_aud.mp3")
|
64 |
|
65 |
+
# @spaces.GPU(duration=120)
|
66 |
+
# def gpu_wrapped_stf_pipeline_execute(audio_path):
|
67 |
+
# return stf_pipeline.execute(audio_path)
|
68 |
|
69 |
|
70 |
+
# ###### 테스트중 ######
|
71 |
|
72 |
|
73 |
+
# stf_pipeline = STFPipeline()
|
74 |
+
# driving_video_path=gr.Video()
|
75 |
|
76 |
+
# # set tyro theme
|
77 |
+
# tyro.extras.set_accent_color("bright_cyan")
|
78 |
+
# args = tyro.cli(ArgumentConfig)
|
79 |
|
80 |
+
# with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
81 |
+
# with gr.Row():
|
82 |
+
# audio_path_component = gr.Textbox(label="Input", value="assets/examples/driving/test_aud.mp3")
|
83 |
+
# stf_button = gr.Button("stf test", variant="primary")
|
84 |
+
# stf_button.click(
|
85 |
+
# fn=gpu_wrapped_stf_pipeline_execute,
|
86 |
+
# inputs=[
|
87 |
+
# audio_path_component
|
88 |
+
# ],
|
89 |
+
# outputs=[driving_video_path]
|
90 |
+
# )
|
91 |
+
# with gr.Row():
|
92 |
+
# driving_video_path.render()
|
93 |
|
94 |
+
# # with gr.Row():
|
95 |
+
# # create_flux_tab() # image_input을 flux_tab에 전달합니다.
|
96 |
|
97 |
+
# ###### 테스트중 ######
|
98 |
|
99 |
|
100 |
+
def partial_fields(target_class, kwargs):
|
101 |
+
return target_class(**{k: v for k, v in kwargs.items() if hasattr(target_class, k)})
|
102 |
|
103 |
+
# set tyro theme
|
104 |
+
tyro.extras.set_accent_color("bright_cyan")
|
105 |
+
args = tyro.cli(ArgumentConfig)
|
106 |
|
107 |
+
# specify configs for inference
|
108 |
+
inference_cfg = partial_fields(InferenceConfig, args.__dict__) # use attribute of args to initial InferenceConfig
|
109 |
+
crop_cfg = partial_fields(CropConfig, args.__dict__) # use attribute of args to initial CropConfig
|
110 |
|
111 |
+
gradio_pipeline = GradioPipeline(
|
112 |
+
inference_cfg=inference_cfg,
|
113 |
+
crop_cfg=crop_cfg,
|
114 |
+
args=args
|
115 |
+
)
|
116 |
|
117 |
+
# 추가 정의
|
118 |
+
elevenlabs_pipeline = ElevenLabsPipeline()
|
119 |
+
stf_pipeline = STFPipeline()
|
120 |
|
121 |
|
122 |
+
@spaces.GPU() #duration=240)
|
123 |
+
def gpu_wrapped_stf_pipeline_execute(audio_path):
|
124 |
+
return stf_pipeline.execute(audio_path)
|
125 |
|
126 |
|
127 |
+
@spaces.GPU()
|
128 |
+
def gpu_wrapped_elevenlabs_pipeline_generate_voice(text, voice):
|
129 |
+
return elevenlabs_pipeline.generate_voice(text, voice)
|
130 |
|
131 |
|
132 |
|
133 |
+
@spaces.GPU()
|
134 |
+
def gpu_wrapped_execute_video(*args, **kwargs):
|
135 |
+
return gradio_pipeline.execute_video(*args, **kwargs)
|
136 |
|
137 |
+
@spaces.GPU()
|
138 |
+
def gpu_wrapped_execute_image(*args, **kwargs):
|
139 |
+
return gradio_pipeline.execute_image(*args, **kwargs)
|
140 |
|
141 |
+
def is_square_video(video_path):
|
142 |
+
video = cv2.VideoCapture(video_path)
|
143 |
|
144 |
+
width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH))
|
145 |
+
height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
146 |
|
147 |
+
video.release()
|
148 |
+
if width != height:
|
149 |
+
raise gr.Error("Error: the video does not have a square aspect ratio. We currently only support square videos")
|
150 |
|
151 |
+
return gr.update(visible=True)
|
152 |
|
|
|
|
|
|
|
|
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
+
# assets
|
156 |
+
title_md = "assets/gradio_title.md"
|
157 |
+
example_portrait_dir = "assets/examples/source"
|
158 |
+
example_portrait_dir_custom = "assets/examples/source"
|
159 |
+
example_video_dir = "assets/examples/driving"
|
160 |
+
data_examples = [
|
161 |
+
[osp.join(example_portrait_dir, "s9.jpg"), osp.join(example_video_dir, "d0.mp4"), True, True, True, True],
|
162 |
+
[osp.join(example_portrait_dir, "s6.jpg"), osp.join(example_video_dir, "d0.mp4"), True, True, True, True],
|
163 |
+
[osp.join(example_portrait_dir, "s10.jpg"), osp.join(example_video_dir, "d0.mp4"), True, True, True, True],
|
164 |
+
[osp.join(example_portrait_dir, "s5.jpg"), osp.join(example_video_dir, "d18.mp4"), True, True, True, True],
|
165 |
+
[osp.join(example_portrait_dir, "s7.jpg"), osp.join(example_video_dir, "d19.mp4"), True, True, True, True],
|
166 |
+
[osp.join(example_portrait_dir, "s22.jpg"), osp.join(example_video_dir, "d0.mp4"), True, True, True, True],
|
167 |
+
]
|
168 |
+
#################### interface logic ####################
|
169 |
|
170 |
+
# Define components first
|
171 |
+
eye_retargeting_slider = gr.Slider(minimum=0, maximum=0.8, step=0.01, label="target eyes-open ratio")
|
172 |
+
lip_retargeting_slider = gr.Slider(minimum=0, maximum=0.8, step=0.01, label="target lip-open ratio")
|
173 |
+
retargeting_input_image = gr.Image(type="filepath")
|
174 |
+
output_image = gr.Image(type="numpy")
|
175 |
+
output_image_paste_back = gr.Image(type="numpy")
|
176 |
+
output_video = gr.Video()
|
177 |
+
output_video_concat = gr.Video()
|
178 |
|
179 |
+
# video_input = gr.Video()
|
180 |
+
driving_video_path=gr.Video()
|
181 |
|
182 |
+
|
183 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
184 |
+
#gr.HTML(load_description(title_md))
|
185 |
+
|
186 |
+
with gr.Tabs():
|
187 |
+
with gr.Tab("Text to LipSync"):
|
188 |
+
gr.Markdown("# Text to LipSync")
|
189 |
+
with gr.Row():
|
190 |
+
with gr.Column():
|
191 |
+
script_txt = gr.Text()
|
192 |
+
# with gr.Column():
|
193 |
+
# txt2video_gen_button = gr.Button("txt2video generation", variant="primary")
|
194 |
+
|
195 |
+
with gr.Column():
|
196 |
+
audio_gen_button = gr.Button("Audio generation", variant="primary")
|
197 |
+
with gr.Row():
|
198 |
+
output_audio = gr.Audio(label="Generated audio", type="filepath")
|
199 |
+
with gr.Row():
|
200 |
+
video_gen_button = gr.Button("Audio to Video generation", variant="primary")
|
201 |
+
with gr.Row():
|
202 |
+
a2v_output = gr.Video()
|
203 |
|
204 |
|
205 |
|
206 |
+
gr.Markdown(load_description("assets/gradio_description_upload.md"))
|
207 |
+
with gr.Row():
|
208 |
+
with gr.Accordion(open=True, label="Source Portrait"):
|
209 |
+
image_input = gr.Image(type="filepath")
|
210 |
+
gr.Examples(
|
211 |
+
examples=[
|
212 |
+
[osp.join(example_portrait_dir, "01.webp")],
|
213 |
+
[osp.join(example_portrait_dir, "02.webp")],
|
214 |
+
[osp.join(example_portrait_dir, "03.jpg")],
|
215 |
+
[osp.join(example_portrait_dir, "04.jpg")],
|
216 |
+
[osp.join(example_portrait_dir, "05.jpg")],
|
217 |
+
[osp.join(example_portrait_dir, "06.jpg")],
|
218 |
+
[osp.join(example_portrait_dir, "07.jpg")],
|
219 |
+
[osp.join(example_portrait_dir, "08.jpg")],
|
220 |
+
],
|
221 |
+
inputs=[image_input],
|
222 |
+
cache_examples=False,
|
223 |
+
)
|
224 |
+
with gr.Accordion(open=True, label="Driving Video"):
|
225 |
+
video_input = gr.Video()
|
226 |
+
gr.Examples(
|
227 |
+
examples=[
|
228 |
+
[osp.join(example_video_dir, "d0.mp4")],
|
229 |
+
[osp.join(example_video_dir, "d18.mp4")],
|
230 |
+
[osp.join(example_video_dir, "d19.mp4")],
|
231 |
+
[osp.join(example_video_dir, "d14_trim.mp4")],
|
232 |
+
[osp.join(example_video_dir, "d6_trim.mp4")],
|
233 |
+
],
|
234 |
+
inputs=[video_input],
|
235 |
+
cache_examples=False,
|
236 |
+
)
|
237 |
+
with gr.Row():
|
238 |
+
with gr.Accordion(open=False, label="Animation Instructions and Options"):
|
239 |
+
gr.Markdown(load_description("assets/gradio_description_animation.md"))
|
240 |
+
with gr.Row():
|
241 |
+
flag_relative_input = gr.Checkbox(value=True, label="relative motion")
|
242 |
+
flag_do_crop_input = gr.Checkbox(value=True, label="do crop")
|
243 |
+
flag_remap_input = gr.Checkbox(value=True, label="paste-back")
|
244 |
+
gr.Markdown(load_description("assets/gradio_description_animate_clear.md"))
|
245 |
+
with gr.Row():
|
246 |
+
with gr.Column():
|
247 |
+
process_button_animation = gr.Button("🚀 Animate", variant="primary")
|
248 |
+
with gr.Column():
|
249 |
+
process_button_reset = gr.ClearButton([image_input, video_input, output_video, output_video_concat], value="🧹 Clear")
|
250 |
+
with gr.Row():
|
251 |
+
with gr.Column():
|
252 |
+
with gr.Accordion(open=True, label="The animated video in the original image space"):
|
253 |
+
output_video.render()
|
254 |
+
with gr.Column():
|
255 |
+
with gr.Accordion(open=True, label="The animated video"):
|
256 |
+
output_video_concat.render()
|
257 |
+
with gr.Row():
|
258 |
+
# Examples
|
259 |
+
gr.Markdown("## You could also choose the examples below by one click ⬇️")
|
260 |
+
with gr.Row():
|
261 |
+
gr.Examples(
|
262 |
+
examples=data_examples,
|
263 |
+
fn=gpu_wrapped_execute_video,
|
264 |
+
inputs=[
|
265 |
+
image_input,
|
266 |
+
video_input,
|
267 |
+
flag_relative_input,
|
268 |
+
flag_do_crop_input,
|
269 |
+
flag_remap_input
|
270 |
+
],
|
271 |
+
outputs=[output_image, output_image_paste_back],
|
272 |
+
examples_per_page=6,
|
273 |
+
cache_examples=False,
|
274 |
+
)
|
275 |
|
276 |
+
process_button_animation.click(
|
277 |
+
fn=gpu_wrapped_execute_video,
|
278 |
+
inputs=[
|
279 |
+
image_input,
|
280 |
+
video_input,
|
281 |
+
flag_relative_input,
|
282 |
+
flag_do_crop_input,
|
283 |
+
flag_remap_input
|
284 |
+
],
|
285 |
+
outputs=[output_video, output_video_concat],
|
286 |
+
show_progress=True
|
287 |
+
)
|
288 |
+
# txt2video_gen_button.click(
|
289 |
+
# fn=txt_to_driving_video,
|
290 |
+
# inputs=[
|
291 |
+
# script_txt
|
292 |
+
# ],
|
293 |
+
# outputs=[video_input],
|
294 |
+
# show_progress=True
|
295 |
+
# )
|
296 |
+
audio_gen_button.click(
|
297 |
+
fn=gpu_wrapped_elevenlabs_pipeline_generate_voice,
|
298 |
+
inputs=[
|
299 |
+
script_txt
|
300 |
+
],
|
301 |
+
outputs=[output_audio],
|
302 |
+
show_progress=True
|
303 |
+
)
|
304 |
+
|
305 |
+
video_gen_button.click(
|
306 |
+
fn=gpu_wrapped_stf_pipeline_execute,
|
307 |
+
inputs=[
|
308 |
+
output_audio
|
309 |
+
],
|
310 |
+
outputs=[a2v_output],
|
311 |
+
show_progress=True
|
312 |
+
)
|
313 |
|
314 |
|
315 |
|
316 |
+
# image_input.change(
|
317 |
+
# fn=gradio_pipeline.prepare_retargeting,
|
318 |
+
# inputs=image_input,
|
319 |
+
# outputs=[eye_retargeting_slider, lip_retargeting_slider, retargeting_input_image]
|
320 |
+
# )
|
321 |
+
video_input.upload(
|
322 |
+
fn=is_square_video,
|
323 |
+
inputs=video_input,
|
324 |
+
outputs=video_input
|
325 |
+
)
|
326 |
|
327 |
+
# 세 번째 탭: Flux 개발용 탭
|
328 |
+
with gr.Tab("FLUX Image"):
|
329 |
+
flux_demo = create_flux_tab(image_input) # Flux 개발용 탭 생성
|
330 |
|
331 |
demo.launch(
|
332 |
server_port=args.server_port,
|