Cpldxx commited on
Commit
0e53494
·
verified ·
1 Parent(s): af399e3

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -3,16 +3,17 @@ import gradio as gr
3
  import torch
4
  from diffusers import FluxPipeline
5
 
6
- # 모델 로드 (Space 시작할 만)
7
  pipe = FluxPipeline.from_pretrained(
8
  "black-forest-labs/FLUX.1-dev",
9
  torch_dtype=torch.bfloat16,
10
  )
11
  pipe.load_lora_weights("Cpldxx/onesomestyle-dora")
12
- pipe.to("cuda")
13
 
14
  @spaces.GPU(duration=120)
15
  def generate(prompt, steps=28, guidance=3.5, width=1024, height=1024, seed=-1):
 
16
  if seed == -1:
17
  seed = torch.randint(0, 2**32, (1,)).item()
18
  generator = torch.Generator("cuda").manual_seed(seed)
@@ -45,4 +46,3 @@ with gr.Blocks() as demo:
45
  btn.click(generate, inputs=[prompt, steps, guidance, width, height, seed], outputs=output)
46
 
47
  demo.launch()
48
-
 
3
  import torch
4
  from diffusers import FluxPipeline
5
 
6
+ # CPU에 로드 (ZeroGPU는 GPU를 함수 실행할 붙여줌)
7
  pipe = FluxPipeline.from_pretrained(
8
  "black-forest-labs/FLUX.1-dev",
9
  torch_dtype=torch.bfloat16,
10
  )
11
  pipe.load_lora_weights("Cpldxx/onesomestyle-dora")
12
+ # pipe.to("cuda") ← 이거 지워야 함
13
 
14
  @spaces.GPU(duration=120)
15
  def generate(prompt, steps=28, guidance=3.5, width=1024, height=1024, seed=-1):
16
+ pipe.to("cuda") # ← 여기서 GPU로 이동
17
  if seed == -1:
18
  seed = torch.randint(0, 2**32, (1,)).item()
19
  generator = torch.Generator("cuda").manual_seed(seed)
 
46
  btn.click(generate, inputs=[prompt, steps, guidance, width, height, seed], outputs=output)
47
 
48
  demo.launch()