Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,9 +17,12 @@ from diffusers.utils.import_utils import is_xformers_available
|
|
| 17 |
from consisti2v.pipelines.pipeline_conditional_animation import ConditionalAnimationPipeline
|
| 18 |
from consisti2v.utils.util import save_videos_grid
|
| 19 |
from omegaconf import OmegaConf
|
|
|
|
| 20 |
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
sample_idx
|
| 23 |
scheduler_dict = {
|
| 24 |
"DDIM": DDIMScheduler,
|
| 25 |
}
|
|
@@ -33,9 +36,8 @@ css = """
|
|
| 33 |
}
|
| 34 |
"""
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
savedir = os.path.join(basedir, "samples/Gradio", datetime.now().strftime("%Y-%m-%dT%H-%M-%S"))
|
| 39 |
savedir_sample = os.path.join(savedir, "sample")
|
| 40 |
os.makedirs(savedir, exist_ok=True)
|
| 41 |
|
|
@@ -207,8 +209,11 @@ def animate(
|
|
| 207 |
filter_params = OmegaConf.create({'method': 'gaussian', 'd_s': 0.25, 'd_t': 0.25,})
|
| 208 |
)
|
| 209 |
|
|
|
|
|
|
|
|
|
|
| 210 |
sample = pipeline(
|
| 211 |
-
|
| 212 |
negative_prompt = negative_prompt_textbox,
|
| 213 |
first_frames = first_frame,
|
| 214 |
num_inference_steps = sample_step_slider,
|
|
@@ -259,7 +264,7 @@ def ui():
|
|
| 259 |
)
|
| 260 |
|
| 261 |
with gr.Row():
|
| 262 |
-
prompt_textbox = gr.Textbox(label="
|
| 263 |
negative_prompt_textbox = gr.Textbox(label="Negative prompt", lines=2)
|
| 264 |
|
| 265 |
with gr.Row(equal_height=False):
|
|
|
|
| 17 |
from consisti2v.pipelines.pipeline_conditional_animation import ConditionalAnimationPipeline
|
| 18 |
from consisti2v.utils.util import save_videos_grid
|
| 19 |
from omegaconf import OmegaConf
|
| 20 |
+
from transformers import pipeline as translation_pipeline
|
| 21 |
|
| 22 |
+
# Translation pipeline for Korean to English
|
| 23 |
+
translator = translation_pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
| 24 |
|
| 25 |
+
sample_idx = 0
|
| 26 |
scheduler_dict = {
|
| 27 |
"DDIM": DDIMScheduler,
|
| 28 |
}
|
|
|
|
| 36 |
}
|
| 37 |
"""
|
| 38 |
|
| 39 |
+
basedir = os.getcwd()
|
| 40 |
+
savedir = os.path.join(basedir, "samples/Gradio", datetime.now().strftime("%Y-%m-%dT%H-%M-%S"))
|
|
|
|
| 41 |
savedir_sample = os.path.join(savedir, "sample")
|
| 42 |
os.makedirs(savedir, exist_ok=True)
|
| 43 |
|
|
|
|
| 209 |
filter_params = OmegaConf.create({'method': 'gaussian', 'd_s': 0.25, 'd_t': 0.25,})
|
| 210 |
)
|
| 211 |
|
| 212 |
+
# Translate Korean prompt to English
|
| 213 |
+
translated_prompt = translator(prompt_textbox, src_lang="ko", tgt_lang="en")[0]['translation_text']
|
| 214 |
+
|
| 215 |
sample = pipeline(
|
| 216 |
+
translated_prompt,
|
| 217 |
negative_prompt = negative_prompt_textbox,
|
| 218 |
first_frames = first_frame,
|
| 219 |
num_inference_steps = sample_step_slider,
|
|
|
|
| 264 |
)
|
| 265 |
|
| 266 |
with gr.Row():
|
| 267 |
+
prompt_textbox = gr.Textbox(label="프롬프트 (한글)", lines=2)
|
| 268 |
negative_prompt_textbox = gr.Textbox(label="Negative prompt", lines=2)
|
| 269 |
|
| 270 |
with gr.Row(equal_height=False):
|