aiqtech commited on
Commit
2552e0c
ยท
verified ยท
1 Parent(s): 8b761b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -320,8 +320,7 @@ if __name__ == "__main__":
320
  try:
321
  # 3D ์ƒ์„ฑ ํŒŒ์ดํ”„๋ผ์ธ
322
  pipeline = TrellisImageTo3DPipeline.from_pretrained(
323
- "JeffreyXiang/TRELLIS-image-large",
324
- token=HF_TOKEN # use_auth_token ๋Œ€์‹  token ์‚ฌ์šฉ
325
  )
326
  pipeline.to(device)
327
 
@@ -329,7 +328,7 @@ if __name__ == "__main__":
329
  pipe = FluxPipeline.from_pretrained(
330
  "black-forest-labs/FLUX.1-dev",
331
  torch_dtype=torch.bfloat16,
332
- token=HF_TOKEN, # use_auth_token ๋Œ€์‹  token ์‚ฌ์šฉ
333
  device_map="auto"
334
  )
335
 
@@ -337,7 +336,7 @@ if __name__ == "__main__":
337
  lora_path = hf_hub_download(
338
  "ByteDance/Hyper-SD",
339
  "Hyper-FLUX.1-dev-8steps-lora.safetensors",
340
- token=HF_TOKEN # use_auth_token ๋Œ€์‹  token ์‚ฌ์šฉ
341
  )
342
  pipe.load_lora_weights(lora_path)
343
  pipe.fuse_lora(lora_scale=0.125)
@@ -346,9 +345,13 @@ if __name__ == "__main__":
346
  translator = pipeline(
347
  "translation",
348
  model="Helsinki-NLP/opus-mt-ko-en",
349
- device=0 if torch.cuda.is_available() else -1
350
  )
351
 
 
 
 
 
352
  # ์ดˆ๊ธฐ ์ด๋ฏธ์ง€ ์ „์ฒ˜๋ฆฌ ํ…Œ์ŠคํŠธ
353
  try:
354
  test_image = Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))
 
320
  try:
321
  # 3D ์ƒ์„ฑ ํŒŒ์ดํ”„๋ผ์ธ
322
  pipeline = TrellisImageTo3DPipeline.from_pretrained(
323
+ "JeffreyXiang/TRELLIS-image-large"
 
324
  )
325
  pipeline.to(device)
326
 
 
328
  pipe = FluxPipeline.from_pretrained(
329
  "black-forest-labs/FLUX.1-dev",
330
  torch_dtype=torch.bfloat16,
331
+ use_auth_token=HF_TOKEN, # token ๋Œ€์‹  use_auth_token ์‚ฌ์šฉ
332
  device_map="auto"
333
  )
334
 
 
336
  lora_path = hf_hub_download(
337
  "ByteDance/Hyper-SD",
338
  "Hyper-FLUX.1-dev-8steps-lora.safetensors",
339
+ use_auth_token=HF_TOKEN # token ๋Œ€์‹  use_auth_token ์‚ฌ์šฉ
340
  )
341
  pipe.load_lora_weights(lora_path)
342
  pipe.fuse_lora(lora_scale=0.125)
 
345
  translator = pipeline(
346
  "translation",
347
  model="Helsinki-NLP/opus-mt-ko-en",
348
+ device=device
349
  )
350
 
351
+ # CUDA ๋ฉ”๋ชจ๋ฆฌ ์ดˆ๊ธฐํ™”
352
+ if torch.cuda.is_available():
353
+ torch.cuda.empty_cache()
354
+
355
  # ์ดˆ๊ธฐ ์ด๋ฏธ์ง€ ์ „์ฒ˜๋ฆฌ ํ…Œ์ŠคํŠธ
356
  try:
357
  test_image = Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))