seawolf2357 commited on
Commit
5c708d4
ยท
verified ยท
1 Parent(s): d5c6079

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -20,7 +20,7 @@ from funcs import (
20
  get_latent_z,
21
  save_videos
22
  )
23
-
24
 
25
  def download_model():
26
  REPO_ID = 'Doubiiu/DynamiCrafter_1024'
@@ -32,7 +32,6 @@ def download_model():
32
  if not os.path.exists(local_file):
33
  hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='./checkpoints/dynamicrafter_1024_v1/', force_download=True)
34
 
35
-
36
  download_model()
37
  ckpt_path='checkpoints/dynamicrafter_1024_v1/model.ckpt'
38
  config_file='configs/inference_1024_v1.0.yaml'
@@ -45,9 +44,17 @@ model = load_model_checkpoint(model, ckpt_path)
45
  model.eval()
46
  model = model.cuda()
47
 
 
 
48
 
49
  @spaces.GPU(duration=300)
50
  def infer(image, prompt, steps=50, cfg_scale=7.5, eta=1.0, fs=3, seed=123, video_length=2):
 
 
 
 
 
 
51
  resolution = (576, 1024)
52
  save_fps = 8
53
  seed_everything(seed)
@@ -105,7 +112,7 @@ i2v_examples = [
105
  css = """#input_img {max-width: 1024px !important} #output_vid {max-width: 1024px; max-height: 576px}"""
106
 
107
  with gr.Blocks(analytics_enabled=False, css=css) as dynamicrafter_iface:
108
- gr.Markdown("์ด๋ฏธ์ง€๋กœ ์˜์ƒ ์ƒ์„ฑ ํ…Œ์ŠคํŠธ")
109
  with gr.Tab(label='ImageAnimation_576x1024'):
110
  with gr.Column():
111
  with gr.Row():
 
20
  get_latent_z,
21
  save_videos
22
  )
23
+ from transformers import pipeline
24
 
25
  def download_model():
26
  REPO_ID = 'Doubiiu/DynamiCrafter_1024'
 
32
  if not os.path.exists(local_file):
33
  hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='./checkpoints/dynamicrafter_1024_v1/', force_download=True)
34
 
 
35
  download_model()
36
  ckpt_path='checkpoints/dynamicrafter_1024_v1/model.ckpt'
37
  config_file='configs/inference_1024_v1.0.yaml'
 
44
  model.eval()
45
  model = model.cuda()
46
 
47
+ # ๋ฒˆ์—ญ ๋ชจ๋ธ ์ดˆ๊ธฐํ™”
48
+ translator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
49
 
50
  @spaces.GPU(duration=300)
51
  def infer(image, prompt, steps=50, cfg_scale=7.5, eta=1.0, fs=3, seed=123, video_length=2):
52
+ # ํ•œ๊ธ€ ์ž…๋ ฅ ๊ฐ์ง€ ๋ฐ ๋ฒˆ์—ญ
53
+ if any('\u3131' <= char <= '\u318E' or '\uAC00' <= char <= '\uD7A3' for char in prompt):
54
+ translated = translator(prompt, max_length=512)[0]['translation_text']
55
+ prompt = translated
56
+ print(f"Translated prompt: {prompt}")
57
+
58
  resolution = (576, 1024)
59
  save_fps = 8
60
  seed_everything(seed)
 
112
  css = """#input_img {max-width: 1024px !important} #output_vid {max-width: 1024px; max-height: 576px}"""
113
 
114
  with gr.Blocks(analytics_enabled=False, css=css) as dynamicrafter_iface:
115
+ gr.Markdown("์ด๋ฏธ์ง€๋กœ ์˜์ƒ ์ƒ์„ฑ ํ…Œ์ŠคํŠธ (ํ•œ๊ธ€ ํ”„๋กฌํ”„ํŠธ ์ง€์›)")
116
  with gr.Tab(label='ImageAnimation_576x1024'):
117
  with gr.Column():
118
  with gr.Row():