Spaces:
Sleeping
Sleeping
alex
commited on
Commit
·
652a642
1
Parent(s):
8d8db44
extra examples
Browse files
app.py
CHANGED
|
@@ -570,7 +570,23 @@ def run_example(video_file, allow_lipsync, duration):
|
|
| 570 |
|
| 571 |
return result
|
| 572 |
|
| 573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 574 |
def process_video(video_file, allow_lipsync, duration):
|
| 575 |
"""
|
| 576 |
Gradio callback:
|
|
@@ -1024,7 +1040,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 1024 |
|
| 1025 |
video_output = gr.Video(label="Output", height=512)
|
| 1026 |
lipsync = gr.Checkbox(label="Lipsync", value=False, visible=False)
|
| 1027 |
-
duration = gr.Slider(
|
| 1028 |
translate_btn = gr.Button("🤹♂️ Translate")
|
| 1029 |
translate_lipsync_btn = gr.Button("🤹♂️ Translate + 💋 Lipsync", variant='primary', elem_classes="button-gradient")
|
| 1030 |
|
|
@@ -1034,47 +1050,29 @@ with gr.Blocks(css=css) as demo:
|
|
| 1034 |
|
| 1035 |
cached_examples = gr.Examples(
|
| 1036 |
examples=[
|
| 1037 |
-
|
| 1038 |
-
[
|
| 1039 |
-
"assets/popup-2.mp4",
|
| 1040 |
-
False,
|
| 1041 |
-
10
|
| 1042 |
-
],
|
| 1043 |
-
|
| 1044 |
-
[
|
| 1045 |
-
"assets/popup-2.mp4",
|
| 1046 |
-
False,
|
| 1047 |
-
20
|
| 1048 |
-
],
|
| 1049 |
|
| 1050 |
[
|
| 1051 |
-
"assets/
|
| 1052 |
-
False,
|
| 1053 |
-
30
|
| 1054 |
-
],
|
| 1055 |
-
|
| 1056 |
-
[
|
| 1057 |
-
"assets/german.mp4",
|
| 1058 |
True,
|
| 1059 |
10
|
| 1060 |
],
|
| 1061 |
|
| 1062 |
[
|
| 1063 |
-
"assets/
|
| 1064 |
True,
|
| 1065 |
-
|
| 1066 |
],
|
| 1067 |
-
|
| 1068 |
[
|
| 1069 |
-
"assets/
|
| 1070 |
True,
|
| 1071 |
-
|
| 1072 |
],
|
| 1073 |
-
|
| 1074 |
[
|
| 1075 |
-
"assets/
|
| 1076 |
True,
|
| 1077 |
-
|
| 1078 |
],
|
| 1079 |
|
| 1080 |
[
|
|
|
|
| 570 |
|
| 571 |
return result
|
| 572 |
|
| 573 |
+
def get_duration(video_file, allow_lipsync, duration):
|
| 574 |
+
|
| 575 |
+
if allow_lipsync:
|
| 576 |
+
if duration <= 3:
|
| 577 |
+
return 30
|
| 578 |
+
elif duration <= 5:
|
| 579 |
+
return 60
|
| 580 |
+
elif duration <= 10:
|
| 581 |
+
return 90
|
| 582 |
+
elif duration <= 20:
|
| 583 |
+
return 120
|
| 584 |
+
elif duration <= 30:
|
| 585 |
+
return 150
|
| 586 |
+
else:
|
| 587 |
+
return 40
|
| 588 |
+
|
| 589 |
+
@spaces.GPU(duration=get_duration)
|
| 590 |
def process_video(video_file, allow_lipsync, duration):
|
| 591 |
"""
|
| 592 |
Gradio callback:
|
|
|
|
| 1040 |
|
| 1041 |
video_output = gr.Video(label="Output", height=512)
|
| 1042 |
lipsync = gr.Checkbox(label="Lipsync", value=False, visible=False)
|
| 1043 |
+
duration = gr.Slider(5, 30, 30, step=1)
|
| 1044 |
translate_btn = gr.Button("🤹♂️ Translate")
|
| 1045 |
translate_lipsync_btn = gr.Button("🤹♂️ Translate + 💋 Lipsync", variant='primary', elem_classes="button-gradient")
|
| 1046 |
|
|
|
|
| 1050 |
|
| 1051 |
cached_examples = gr.Examples(
|
| 1052 |
examples=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1053 |
|
| 1054 |
[
|
| 1055 |
+
"assets/spanish-2.mp4",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1056 |
True,
|
| 1057 |
10
|
| 1058 |
],
|
| 1059 |
|
| 1060 |
[
|
| 1061 |
+
"assets/spanish.mp4",
|
| 1062 |
True,
|
| 1063 |
+
10
|
| 1064 |
],
|
| 1065 |
+
|
| 1066 |
[
|
| 1067 |
+
"assets/japanese.mp4",
|
| 1068 |
True,
|
| 1069 |
+
10
|
| 1070 |
],
|
| 1071 |
+
|
| 1072 |
[
|
| 1073 |
+
"assets/german.mp4",
|
| 1074 |
True,
|
| 1075 |
+
10
|
| 1076 |
],
|
| 1077 |
|
| 1078 |
[
|