Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,26 +5,22 @@ import cv2
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
def image_to_video(image):
|
| 8 |
-
# ์ด๋ฏธ์ง๋ฅผ NumPy ๋ฐฐ์ด๋ก ๋ณํ
|
| 9 |
image_array = np.array(image)
|
| 10 |
-
|
| 11 |
-
# ๋น๋์ค ์ ์ฅ ๊ฒฝ๋ก์ ์ด๋ฆ ์ค์
|
| 12 |
output_path = '/mnt/data/output_video.mp4'
|
| 13 |
|
| 14 |
-
# ๋น๋์ค ๋ผ์ดํฐ ์ค์
|
| 15 |
height, width, layers = image_array.shape
|
| 16 |
size = (width, height)
|
| 17 |
-
video = cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*'mp4v'),
|
| 18 |
|
| 19 |
-
|
| 20 |
-
for _ in range(5): # 5 ํ๋ ์ ์์ฑ
|
| 21 |
video.write(image_array)
|
| 22 |
|
| 23 |
-
# ๋น๋์ค ์์ฑ ์ข
๋ฃ
|
| 24 |
video.release()
|
| 25 |
|
| 26 |
return output_path
|
| 27 |
|
|
|
|
|
|
|
| 28 |
def setup_interface():
|
| 29 |
# Gradio ์ธํฐํ์ด์ค ๊ตฌ์ฑ
|
| 30 |
with gr.Blocks() as demo:
|
|
|
|
| 5 |
import os
|
| 6 |
|
| 7 |
def image_to_video(image):
|
|
|
|
| 8 |
image_array = np.array(image)
|
|
|
|
|
|
|
| 9 |
output_path = '/mnt/data/output_video.mp4'
|
| 10 |
|
|
|
|
| 11 |
height, width, layers = image_array.shape
|
| 12 |
size = (width, height)
|
| 13 |
+
video = cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*'mp4v'), 30, size)
|
| 14 |
|
| 15 |
+
for _ in range(150): # ์ด 150 ํ๋ ์ ์์ฑ
|
|
|
|
| 16 |
video.write(image_array)
|
| 17 |
|
|
|
|
| 18 |
video.release()
|
| 19 |
|
| 20 |
return output_path
|
| 21 |
|
| 22 |
+
|
| 23 |
+
|
| 24 |
def setup_interface():
|
| 25 |
# Gradio ์ธํฐํ์ด์ค ๊ตฌ์ฑ
|
| 26 |
with gr.Blocks() as demo:
|