Spaces:
Running
on
L40S
Running
on
L40S
Update app.py
Browse files
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 |
|