Spaces:
Sleeping
Sleeping
seawolf2357
commited on
Commit
β’
5d3bf28
1
Parent(s):
80d6daf
Update app.py
Browse files
app.py
CHANGED
@@ -7,14 +7,20 @@ def images_to_video(image_files):
|
|
7 |
# μμ λλ ν°λ¦¬ μμ±
|
8 |
temp_dir = tempfile.mkdtemp()
|
9 |
|
10 |
-
# μ΄λ―Έμ§ νμΌμ μμ λλ ν°λ¦¬λ‘ μ μ₯
|
11 |
image_paths = []
|
12 |
for i, image_file in enumerate(image_files):
|
|
|
|
|
|
|
|
|
|
|
13 |
image_path = os.path.join(temp_dir, f"image_{i}.png")
|
14 |
-
with open(image_path, "wb") as f:
|
15 |
-
f.write(image_file)
|
16 |
image_paths.append(image_path)
|
17 |
|
|
|
|
|
18 |
# μ΄λ―Έμ§ μνμ€λ‘λΆν° λΉλμ€ ν΄λ¦½ μμ± (κ° μ΄λ―Έμ§μ μ§μ μκ°μ 2μ΄)
|
19 |
clip = ImageSequenceClip(image_paths, fps=0.5) # fps=0.5 => κ° μ΄λ―Έμ§λ 2μ΄ λμ 보μ
|
20 |
|
|
|
7 |
# μμ λλ ν°λ¦¬ μμ±
|
8 |
temp_dir = tempfile.mkdtemp()
|
9 |
|
|
|
10 |
image_paths = []
|
11 |
for i, image_file in enumerate(image_files):
|
12 |
+
# μ
λ‘λλ νμΌμ΄ λ°μ΄νΈ ννμΈμ§ νμΈνκ³ , κ·Έλ μ§ μλ€λ©΄ λ³ν
|
13 |
+
if not isinstance(image_file, bytes):
|
14 |
+
# νμΌ λ΄μ©μ λ°μ΄νΈλ‘ λ³ν (μ΄ λΆλΆμ μ
λ‘λλ νμΌ ννμ λ°λΌ λ¬λΌμ§ μ μμ)
|
15 |
+
image_file = image_file.read() # Gradioμμ μ
λ‘λλ νμΌ μ²λ¦¬ μ μ¬μ©
|
16 |
+
|
17 |
image_path = os.path.join(temp_dir, f"image_{i}.png")
|
18 |
+
with open(image_path, "wb") as f: # λ°μ΄λ리 λͺ¨λλ‘ νμΌ μ΄κΈ°
|
19 |
+
f.write(image_file) # μ΄λ―Έμ§ νμΌ λ΄μ©μ λμ€ν¬μ μ°κΈ°
|
20 |
image_paths.append(image_path)
|
21 |
|
22 |
+
# μ΄λ―Έμ§ μνμ€λ‘λΆν° λΉλμ€ ν΄λ¦½ μμ± λ° κΈ°ν λ‘μ§...
|
23 |
+
|
24 |
# μ΄λ―Έμ§ μνμ€λ‘λΆν° λΉλμ€ ν΄λ¦½ μμ± (κ° μ΄λ―Έμ§μ μ§μ μκ°μ 2μ΄)
|
25 |
clip = ImageSequenceClip(image_paths, fps=0.5) # fps=0.5 => κ° μ΄λ―Έμ§λ 2μ΄ λμ 보μ
|
26 |
|