Spaces:
Sleeping
Sleeping
Update video_processing.py
Browse files- video_processing.py +4 -1
video_processing.py
CHANGED
@@ -15,6 +15,8 @@ import numpy as np
|
|
15 |
import logging
|
16 |
from multiprocessing import Pool
|
17 |
from concurrent.futures import ThreadPoolExecutor
|
|
|
|
|
18 |
|
19 |
|
20 |
|
@@ -145,7 +147,8 @@ def analyze_scenes(video_path, scenes, description):
|
|
145 |
tasks.append((frame, positive_feature, negative_features))
|
146 |
|
147 |
scene_results = {}
|
148 |
-
|
|
|
149 |
results = list(executor.map(analyze_frame, tasks))
|
150 |
|
151 |
for ((start_time, end_time), (scene_prob, sentiments)) in zip(scenes, results):
|
|
|
15 |
import logging
|
16 |
from multiprocessing import Pool
|
17 |
from concurrent.futures import ThreadPoolExecutor
|
18 |
+
from concurrent.futures import ProcessPoolExecutor
|
19 |
+
|
20 |
|
21 |
|
22 |
|
|
|
147 |
tasks.append((frame, positive_feature, negative_features))
|
148 |
|
149 |
scene_results = {}
|
150 |
+
|
151 |
+
with ProcessPoolExecutor(max_workers=8) as executor:
|
152 |
results = list(executor.map(analyze_frame, tasks))
|
153 |
|
154 |
for ((start_time, end_time), (scene_prob, sentiments)) in zip(scenes, results):
|