Spaces:
Sleeping
Sleeping
seawolf2357
commited on
Commit
β’
513a44d
1
Parent(s):
a0b6e16
Update app.py
Browse files
app.py
CHANGED
@@ -6,21 +6,16 @@ import shutil # μ΄ λΆλΆμ μΆκ°
|
|
6 |
|
7 |
|
8 |
def images_to_video(image_files):
|
|
|
9 |
temp_dir = tempfile.mkdtemp()
|
10 |
-
image_paths = []
|
11 |
|
|
|
12 |
for i, image_file in enumerate(image_files):
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
f.write(image_file)
|
19 |
-
else:
|
20 |
-
# shutil λͺ¨λμ copy ν¨μ μ¬μ©
|
21 |
-
shutil.copy(image_file, image_path)
|
22 |
-
|
23 |
-
image_paths.append(image_path)
|
24 |
|
25 |
# μ΄λ―Έμ§ μνμ€λ‘λΆν° λΉλμ€ ν΄λ¦½ μμ± λ° κΈ°ν λ‘μ§...
|
26 |
|
@@ -35,6 +30,8 @@ def images_to_video(image_files):
|
|
35 |
# μμ±λ λΉλμ€ νμΌ κ²½λ‘ λ°ν
|
36 |
return output_video_path
|
37 |
|
|
|
|
|
38 |
# Gradio μΈν°νμ΄μ€ μ μ
|
39 |
with gr.Blocks() as demo:
|
40 |
with gr.Row():
|
|
|
6 |
|
7 |
|
8 |
def images_to_video(image_files):
|
9 |
+
# μμ λλ ν°λ¦¬ μμ±
|
10 |
temp_dir = tempfile.mkdtemp()
|
|
|
11 |
|
12 |
+
image_paths = []
|
13 |
for i, image_file in enumerate(image_files):
|
14 |
+
# μ
λ‘λλ νμΌμ μμ νμΌλ‘ μ μ₯
|
15 |
+
temp_file_path = os.path.join(temp_dir, f"image_{i}.png")
|
16 |
+
with open(temp_file_path, "wb") as f:
|
17 |
+
f.write(image_file.read()) # λ°μ΄νΈ λ°μ΄ν°λ₯Ό νμΌλ‘ μ μ₯
|
18 |
+
image_paths.append(temp_file_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
# μ΄λ―Έμ§ μνμ€λ‘λΆν° λΉλμ€ ν΄λ¦½ μμ± λ° κΈ°ν λ‘μ§...
|
21 |
|
|
|
30 |
# μμ±λ λΉλμ€ νμΌ κ²½λ‘ λ°ν
|
31 |
return output_video_path
|
32 |
|
33 |
+
return image_paths # μμ λ°νκ°, μ€μ λ‘λ μμ±λ λΉλμ€ νμΌ κ²½λ‘λ₯Ό λ°νν΄μΌ ν¨
|
34 |
+
|
35 |
# Gradio μΈν°νμ΄μ€ μ μ
|
36 |
with gr.Blocks() as demo:
|
37 |
with gr.Row():
|