Spaces:
Sleeping
Sleeping
seawolf2357
commited on
Commit
โข
3bdb854
1
Parent(s):
5d3bf28
Update app.py
Browse files
app.py
CHANGED
@@ -9,17 +9,20 @@ def images_to_video(image_files):
|
|
9 |
|
10 |
image_paths = []
|
11 |
for i, image_file in enumerate(image_files):
|
12 |
-
# ์
๋ก๋๋ ํ์ผ์ด
|
13 |
-
|
14 |
-
# ํ์ผ ๋ด์ฉ์ ๋ฐ์ดํธ๋ก ๋ณํ (์ด ๋ถ๋ถ์ ์
๋ก๋๋ ํ์ผ ํํ์ ๋ฐ๋ผ ๋ฌ๋ผ์ง ์ ์์)
|
15 |
-
image_file = image_file.read() # Gradio์์ ์
๋ก๋๋ ํ์ผ ์ฒ๋ฆฌ ์ ์ฌ์ฉ
|
16 |
-
|
17 |
image_path = os.path.join(temp_dir, f"image_{i}.png")
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
20 |
image_paths.append(image_path)
|
21 |
|
22 |
# ์ด๋ฏธ์ง ์ํ์ค๋ก๋ถํฐ ๋น๋์ค ํด๋ฆฝ ์์ฑ ๋ฐ ๊ธฐํ ๋ก์ง...
|
|
|
23 |
|
24 |
# ์ด๋ฏธ์ง ์ํ์ค๋ก๋ถํฐ ๋น๋์ค ํด๋ฆฝ ์์ฑ (๊ฐ ์ด๋ฏธ์ง์ ์ง์ ์๊ฐ์ 2์ด)
|
25 |
clip = ImageSequenceClip(image_paths, fps=0.5) # fps=0.5 => ๊ฐ ์ด๋ฏธ์ง๋ 2์ด ๋์ ๋ณด์
|
|
|
9 |
|
10 |
image_paths = []
|
11 |
for i, image_file in enumerate(image_files):
|
12 |
+
# ์
๋ก๋๋ ํ์ผ์ด ์ด๋ฏธ ํ์ผ ๊ฒฝ๋ก๋ฅผ ๋ํ๋ด๋ ๋ฌธ์์ด์ธ ๊ฒฝ์ฐ,
|
13 |
+
# ํด๋น ๊ฒฝ๋ก๋ฅผ ์ด๋ฏธ์ง ๊ฒฝ๋ก ๋ฆฌ์คํธ์ ์ถ๊ฐ
|
|
|
|
|
|
|
14 |
image_path = os.path.join(temp_dir, f"image_{i}.png")
|
15 |
+
if isinstance(image_file, str):
|
16 |
+
# ์ฌ๊ธฐ์ image_file์ ์ด๋ฏธ ํ์ผ ๊ฒฝ๋ก๋ฅผ ๋ํ๋ด๋ฏ๋ก, ๋ณ๋์ ์ฒ๋ฆฌ ์์ด ์ฌ์ฉ
|
17 |
+
shutil.copy(image_file, image_path)
|
18 |
+
else:
|
19 |
+
# image_file์ด ๋ฐ์ดํธ ๋ฐ์ดํฐ๋ฅผ ํฌํจํ๋ ๊ฒฝ์ฐ, ํ์ผ๋ก ์ฐ๊ธฐ
|
20 |
+
with open(image_path, "wb") as f:
|
21 |
+
f.write(image_file)
|
22 |
image_paths.append(image_path)
|
23 |
|
24 |
# ์ด๋ฏธ์ง ์ํ์ค๋ก๋ถํฐ ๋น๋์ค ํด๋ฆฝ ์์ฑ ๋ฐ ๊ธฐํ ๋ก์ง...
|
25 |
+
|
26 |
|
27 |
# ์ด๋ฏธ์ง ์ํ์ค๋ก๋ถํฐ ๋น๋์ค ํด๋ฆฝ ์์ฑ (๊ฐ ์ด๋ฏธ์ง์ ์ง์ ์๊ฐ์ 2์ด)
|
28 |
clip = ImageSequenceClip(image_paths, fps=0.5) # fps=0.5 => ๊ฐ ์ด๋ฏธ์ง๋ 2์ด ๋์ ๋ณด์
|