Spaces:
				
			
			
	
			
			
		Paused
		
	
	
	
			
			
	
	
	
	
		
		
		Paused
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -328,17 +328,16 @@ if __name__ == "__main__": | |
| 328 |  | 
| 329 | 
             
                try:
         | 
| 330 | 
             
                    # 3D 생성 파이프라인
         | 
| 331 | 
            -
                     | 
| 332 | 
             
                        "JeffreyXiang/TRELLIS-image-large"
         | 
| 333 | 
             
                    )
         | 
| 334 | 
            -
                     | 
| 335 |  | 
| 336 | 
             
                    # 이미지 생성 파이프라인
         | 
| 337 | 
            -
                     | 
| 338 | 
             
                        "black-forest-labs/FLUX.1-dev",
         | 
| 339 | 
             
                        torch_dtype=torch.bfloat16,
         | 
| 340 | 
            -
                         | 
| 341 | 
            -
                        device_map="balanced"  # "auto"에서 "balanced"로 변경
         | 
| 342 | 
             
                    )
         | 
| 343 |  | 
| 344 | 
             
                    # Hyper-SD LoRA 로드
         | 
| @@ -347,11 +346,11 @@ if __name__ == "__main__": | |
| 347 | 
             
                        "Hyper-FLUX.1-dev-8steps-lora.safetensors",
         | 
| 348 | 
             
                        use_auth_token=HF_TOKEN
         | 
| 349 | 
             
                    )
         | 
| 350 | 
            -
                     | 
| 351 | 
            -
                     | 
| 352 |  | 
| 353 | 
             
                    # 번역기 초기화
         | 
| 354 | 
            -
                    translator = pipeline(
         | 
| 355 | 
             
                        "translation", 
         | 
| 356 | 
             
                        model="Helsinki-NLP/opus-mt-ko-en",
         | 
| 357 | 
             
                        device=device
         | 
| @@ -364,7 +363,7 @@ if __name__ == "__main__": | |
| 364 | 
             
                    # 초기 이미지 전처리 테스트
         | 
| 365 | 
             
                    try:
         | 
| 366 | 
             
                        test_image = Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))
         | 
| 367 | 
            -
                         | 
| 368 | 
             
                    except Exception as e:
         | 
| 369 | 
             
                        print(f"Warning: Initial preprocessing test failed: {e}")
         | 
| 370 |  | 
|  | |
| 328 |  | 
| 329 | 
             
                try:
         | 
| 330 | 
             
                    # 3D 생성 파이프라인
         | 
| 331 | 
            +
                    trellis_pipeline = TrellisImageTo3DPipeline.from_pretrained(  # pipeline을 trellis_pipeline으로 변경
         | 
| 332 | 
             
                        "JeffreyXiang/TRELLIS-image-large"
         | 
| 333 | 
             
                    )
         | 
| 334 | 
            +
                    trellis_pipeline.to(device)
         | 
| 335 |  | 
| 336 | 
             
                    # 이미지 생성 파이프라인
         | 
| 337 | 
            +
                    flux_pipe = FluxPipeline.from_pretrained(  # pipe를 flux_pipe로 변경
         | 
| 338 | 
             
                        "black-forest-labs/FLUX.1-dev",
         | 
| 339 | 
             
                        torch_dtype=torch.bfloat16,
         | 
| 340 | 
            +
                        device_map="balanced"
         | 
|  | |
| 341 | 
             
                    )
         | 
| 342 |  | 
| 343 | 
             
                    # Hyper-SD LoRA 로드
         | 
|  | |
| 346 | 
             
                        "Hyper-FLUX.1-dev-8steps-lora.safetensors",
         | 
| 347 | 
             
                        use_auth_token=HF_TOKEN
         | 
| 348 | 
             
                    )
         | 
| 349 | 
            +
                    flux_pipe.load_lora_weights(lora_path)
         | 
| 350 | 
            +
                    flux_pipe.fuse_lora(lora_scale=0.125)
         | 
| 351 |  | 
| 352 | 
             
                    # 번역기 초기화
         | 
| 353 | 
            +
                    translator = transformers.pipeline(  # pipeline을 transformers.pipeline으로 변경
         | 
| 354 | 
             
                        "translation", 
         | 
| 355 | 
             
                        model="Helsinki-NLP/opus-mt-ko-en",
         | 
| 356 | 
             
                        device=device
         | 
|  | |
| 363 | 
             
                    # 초기 이미지 전처리 테스트
         | 
| 364 | 
             
                    try:
         | 
| 365 | 
             
                        test_image = Image.fromarray(np.zeros((512, 512, 3), dtype=np.uint8))
         | 
| 366 | 
            +
                        trellis_pipeline.preprocess_image(test_image)
         | 
| 367 | 
             
                    except Exception as e:
         | 
| 368 | 
             
                        print(f"Warning: Initial preprocessing test failed: {e}")
         | 
| 369 |  | 
 
			
