Spaces:
Running
on
L40S
Running
on
L40S
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,27 @@ from trellis.pipelines import TrellisImageTo3DPipeline
|
|
15 |
from trellis.representations import Gaussian, MeshExtractResult
|
16 |
from trellis.utils import render_utils, postprocessing_utils
|
17 |
|
|
|
|
|
|
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
MAX_SEED = np.iinfo(np.int32).max
|
20 |
TMP_DIR = "/tmp/Trellis-demo"
|
21 |
|
|
|
15 |
from trellis.representations import Gaussian, MeshExtractResult
|
16 |
from trellis.utils import render_utils, postprocessing_utils
|
17 |
|
18 |
+
# 기존 import문 아래에 추가
|
19 |
+
from transformers import pipeline as translation_pipeline
|
20 |
+
from diffusers import FluxPipeline
|
21 |
|
22 |
+
# 초기화 부분에 추가
|
23 |
+
def initialize_models():
|
24 |
+
global pipeline, translator, flux_pipe
|
25 |
+
|
26 |
+
# Trellis 파이프라인 초기화
|
27 |
+
pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
|
28 |
+
pipeline.cuda()
|
29 |
+
|
30 |
+
# 번역기 초기화
|
31 |
+
translator = translation_pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
32 |
+
|
33 |
+
# Flux 파이프라인 초기화
|
34 |
+
flux_pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
|
35 |
+
flux_pipe.load_lora_weights("gokaygokay/Flux-Game-Assets-LoRA-v2")
|
36 |
+
flux_pipe.fuse_lora(lora_scale=1.0)
|
37 |
+
flux_pipe.to(device="cuda", dtype=torch.bfloat16)
|
38 |
+
|
39 |
MAX_SEED = np.iinfo(np.int32).max
|
40 |
TMP_DIR = "/tmp/Trellis-demo"
|
41 |
|