Spaces:
Sleeping
Sleeping
roychao19477
commited on
Commit
·
eb529cf
1
Parent(s):
db5dbc5
Update module
Browse files
app.py
CHANGED
@@ -88,10 +88,13 @@ def run_avse_inference(video_path, audio_path):
|
|
88 |
noisy = wavfile.read(audio_path)[1].astype(np.float32) / (2 ** 15)
|
89 |
|
90 |
# Load grayscale video
|
91 |
-
vr = VideoReader(
|
92 |
frames = vr.get_batch(list(range(len(vr)))).asnumpy()
|
93 |
-
bg_frames = np.array([
|
94 |
-
|
|
|
|
|
|
|
95 |
|
96 |
# Combine into input dict (match what model.enhance expects)
|
97 |
data = {
|
@@ -192,13 +195,6 @@ def extract_faces(video_file):
|
|
192 |
# ------------------------------- #
|
193 |
# AVSE models
|
194 |
|
195 |
-
vr = VideoReader(output_path, ctx=cpu(0))
|
196 |
-
frames = vr.get_batch(list(range(len(vr)))).asnumpy()
|
197 |
-
bg_frames = np.array([
|
198 |
-
cv2.cvtColor(frames[i], cv2.COLOR_RGB2GRAY) for i in range(len(frames))
|
199 |
-
]).astype(np.float32)
|
200 |
-
bg_frames /= 255.0
|
201 |
-
|
202 |
enhanced_audio_path = run_avse_inference(output_path, audio_path)
|
203 |
|
204 |
|
|
|
88 |
noisy = wavfile.read(audio_path)[1].astype(np.float32) / (2 ** 15)
|
89 |
|
90 |
# Load grayscale video
|
91 |
+
vr = VideoReader(output_path, ctx=cpu(0))
|
92 |
frames = vr.get_batch(list(range(len(vr)))).asnumpy()
|
93 |
+
bg_frames = np.array([
|
94 |
+
cv2.cvtColor(frames[i], cv2.COLOR_RGB2GRAY) for i in range(len(frames))
|
95 |
+
]).astype(np.float32)
|
96 |
+
bg_frames /= 255.0
|
97 |
+
|
98 |
|
99 |
# Combine into input dict (match what model.enhance expects)
|
100 |
data = {
|
|
|
195 |
# ------------------------------- #
|
196 |
# AVSE models
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
enhanced_audio_path = run_avse_inference(output_path, audio_path)
|
199 |
|
200 |
|