Spaces:
Runtime error
Runtime error
add installation of imaginaire
Browse files- app.py +2 -4
- install_imaginaire.sh +6 -0
app.py
CHANGED
@@ -9,7 +9,9 @@ import test
|
|
9 |
import importlib
|
10 |
from scipy.interpolate import interp1d, splev, splprep
|
11 |
import cv2
|
|
|
12 |
|
|
|
13 |
|
14 |
def get_single(sat_img, style_img, x_offset, y_offset):
|
15 |
name = ''
|
@@ -139,21 +141,17 @@ def get_video(sat_img, style_img, positions):
|
|
139 |
|
140 |
output_video_path = 'output_video.mp4'
|
141 |
|
142 |
-
# 设置视频的帧率、宽度和高度
|
143 |
frame_rate = 15
|
144 |
frame_width = 512
|
145 |
frame_height = 128
|
146 |
|
147 |
-
# 使用OpenCV创建视频写入对象,选择H.264编码器
|
148 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
149 |
out = cv2.VideoWriter(output_video_path, fourcc, frame_rate, (frame_width, frame_height))
|
150 |
|
151 |
-
# 遍历图像列表并将它们写入视频
|
152 |
for image_np in rendered_image_list:
|
153 |
image_np = cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB)
|
154 |
out.write(image_np)
|
155 |
|
156 |
-
# 释放视频写入对象
|
157 |
out.release()
|
158 |
|
159 |
return "output_video.mp4"
|
|
|
9 |
import importlib
|
10 |
from scipy.interpolate import interp1d, splev, splprep
|
11 |
import cv2
|
12 |
+
import subprocess
|
13 |
|
14 |
+
subprocess.run(["bash", "install_imaginaire.sh"])
|
15 |
|
16 |
def get_single(sat_img, style_img, x_offset, y_offset):
|
17 |
name = ''
|
|
|
141 |
|
142 |
output_video_path = 'output_video.mp4'
|
143 |
|
|
|
144 |
frame_rate = 15
|
145 |
frame_width = 512
|
146 |
frame_height = 128
|
147 |
|
|
|
148 |
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
149 |
out = cv2.VideoWriter(output_video_path, fourcc, frame_rate, (frame_width, frame_height))
|
150 |
|
|
|
151 |
for image_np in rendered_image_list:
|
152 |
image_np = cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB)
|
153 |
out.write(image_np)
|
154 |
|
|
|
155 |
out.release()
|
156 |
|
157 |
return "output_video.mp4"
|
install_imaginaire.sh
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
CURRENT=$(pwd)
|
2 |
+
for p in correlation channelnorm resample2d bias_act upfirdn2d; do
|
3 |
+
cd imaginaire/third_party/${p};
|
4 |
+
python setup.py install;
|
5 |
+
cd ${CURRENT};
|
6 |
+
done
|