Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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 = "
|
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 |
|