aiqtech commited on
Commit
ce0691d
โ€ข
1 Parent(s): ee210e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
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("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
 
 
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