aiqtech commited on
Commit
c589cc5
โ€ข
1 Parent(s): 9294203

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -34,9 +34,18 @@ class GlobalVars:
34
 
35
  g = GlobalVars()
36
 
 
 
37
  def initialize_models(device):
38
  try:
39
  print("Initializing models...")
 
 
 
 
 
 
 
40
  # 3D ์ƒ์„ฑ ํŒŒ์ดํ”„๋ผ์ธ
41
  g.trellis_pipeline = TrellisImageTo3DPipeline.from_pretrained(
42
  "JeffreyXiang/TRELLIS-image-large"
@@ -368,8 +377,10 @@ def text_to_image(prompt: str, height: int, width: int, steps: int, scales: floa
368
  return any(ord('๊ฐ€') <= ord(c) <= ord('ํžฃ') for c in text)
369
 
370
  if contains_korean(prompt):
 
371
  translated = g.translator(prompt)[0]['translation_text']
372
  prompt = translated
 
373
 
374
  formatted_prompt = f"wbgmsst, 3D, {prompt}, white background"
375
 
 
34
 
35
  g = GlobalVars()
36
 
37
+
38
+
39
  def initialize_models(device):
40
  try:
41
  print("Initializing models...")
42
+ g.translator = transformers_pipeline(
43
+ "translation",
44
+ model="Helsinki-NLP/opus-mt-ko-en",
45
+ device=device
46
+ )
47
+ print("Model initialization completed successfully")
48
+
49
  # 3D ์ƒ์„ฑ ํŒŒ์ดํ”„๋ผ์ธ
50
  g.trellis_pipeline = TrellisImageTo3DPipeline.from_pretrained(
51
  "JeffreyXiang/TRELLIS-image-large"
 
377
  return any(ord('๊ฐ€') <= ord(c) <= ord('ํžฃ') for c in text)
378
 
379
  if contains_korean(prompt):
380
+ # Helsinki-NLP/opus-mt-ko-en ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฒˆ์—ญ
381
  translated = g.translator(prompt)[0]['translation_text']
382
  prompt = translated
383
+ print(f"Translated prompt: {prompt}")
384
 
385
  formatted_prompt = f"wbgmsst, 3D, {prompt}, white background"
386