yerang commited on
Commit
b2bd3b3
·
verified ·
1 Parent(s): 1729a2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -37,6 +37,8 @@ flux_pipe.vae.enable_slicing()
37
  flux_pipe.vae.enable_tiling()
38
  flux_pipe.to(torch.float16)
39
 
 
 
40
  def generate_image(prompt, guidance_scale, width, height):
41
  # 이미지를 생성하는 함수
42
  output_image = flux_pipe(
@@ -49,7 +51,7 @@ def generate_image(prompt, guidance_scale, width, height):
49
  ).images[0]
50
 
51
  # 결과 폴더 생성
52
- result_folder = "result_flux"
53
  os.makedirs(result_folder, exist_ok=True)
54
 
55
  # 파일 이름 생성
@@ -58,8 +60,8 @@ def generate_image(prompt, guidance_scale, width, height):
58
  filename = f"{'_'.join(prompt.split()[:3])}_{timestamp}.png"
59
  output_path = os.path.join(result_folder, filename)
60
 
61
- # 이미지를 저장
62
- output_image.save(output_path)
63
 
64
  return output_image, output_path # 두 개의 출력 반환
65
 
 
37
  flux_pipe.vae.enable_tiling()
38
  flux_pipe.to(torch.float16)
39
 
40
+
41
+ @spaces.GPU(duration=120)
42
  def generate_image(prompt, guidance_scale, width, height):
43
  # 이미지를 생성하는 함수
44
  output_image = flux_pipe(
 
51
  ).images[0]
52
 
53
  # 결과 폴더 생성
54
+ result_folder = "/tmp/flux/"
55
  os.makedirs(result_folder, exist_ok=True)
56
 
57
  # 파일 이름 생성
 
60
  filename = f"{'_'.join(prompt.split()[:3])}_{timestamp}.png"
61
  output_path = os.path.join(result_folder, filename)
62
 
63
+ # # 이미지를 저장
64
+ # output_image.save(output_path)
65
 
66
  return output_image, output_path # 두 개의 출력 반환
67