Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,6 +23,11 @@ os.makedirs(TMP_DIR, exist_ok=True)
|
|
| 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()
|
|
@@ -30,9 +35,16 @@ def initialize_models():
|
|
| 30 |
# ๋ฒ์ญ๊ธฐ ์ด๊ธฐํ
|
| 31 |
translator = translation_pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
| 32 |
|
| 33 |
-
# Flux ํ์ดํ๋ผ์ธ ์ด๊ธฐํ
|
| 34 |
-
flux_pipe = FluxPipeline.from_pretrained(
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
flux_pipe.fuse_lora(lora_scale=1.0)
|
| 37 |
flux_pipe.to(device="cuda", dtype=torch.bfloat16)
|
| 38 |
|
|
|
|
| 23 |
def initialize_models():
|
| 24 |
global pipeline, translator, flux_pipe
|
| 25 |
|
| 26 |
+
# Hugging Face ํ ํฐ ํ์ธ
|
| 27 |
+
hf_token = os.getenv("HF_TOKEN")
|
| 28 |
+
if not hf_token:
|
| 29 |
+
raise ValueError("HF_TOKEN environment variable is not set. Please set your Hugging Face token.")
|
| 30 |
+
|
| 31 |
# Trellis ํ์ดํ๋ผ์ธ ์ด๊ธฐํ
|
| 32 |
pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
|
| 33 |
pipeline.cuda()
|
|
|
|
| 35 |
# ๋ฒ์ญ๊ธฐ ์ด๊ธฐํ
|
| 36 |
translator = translation_pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
| 37 |
|
| 38 |
+
# Flux ํ์ดํ๋ผ์ธ ์ด๊ธฐํ - token ์ถ๊ฐ
|
| 39 |
+
flux_pipe = FluxPipeline.from_pretrained(
|
| 40 |
+
"black-forest-labs/FLUX.1-dev",
|
| 41 |
+
torch_dtype=torch.bfloat16,
|
| 42 |
+
use_auth_token=hf_token # Hugging Face ํ ํฐ ์ ์ฉ
|
| 43 |
+
)
|
| 44 |
+
flux_pipe.load_lora_weights(
|
| 45 |
+
"gokaygokay/Flux-Game-Assets-LoRA-v2",
|
| 46 |
+
use_auth_token=hf_token # LoRA ๊ฐ์ค์น ๋ก๋์์๋ ํ ํฐ ์ ์ฉ
|
| 47 |
+
)
|
| 48 |
flux_pipe.fuse_lora(lora_scale=1.0)
|
| 49 |
flux_pipe.to(device="cuda", dtype=torch.bfloat16)
|
| 50 |
|