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