Spaces:
Runtime error
Runtime error
fix: change param to filepath, broaden video length limit
Browse files- src/obs_eval_gradio.py +10 -7
src/obs_eval_gradio.py
CHANGED
@@ -49,7 +49,7 @@ def validate_api_key(api_key):
|
|
49 |
|
50 |
def _process_video(image_file):
|
51 |
# Read and process the video file
|
52 |
-
video = cv2.VideoCapture(image_file)
|
53 |
|
54 |
base64Frames = []
|
55 |
while video.isOpened():
|
@@ -59,8 +59,8 @@ def _process_video(image_file):
|
|
59 |
_, buffer = cv2.imencode(".jpg", frame)
|
60 |
base64Frames.append(base64.b64encode(buffer).decode("utf-8"))
|
61 |
video.release()
|
62 |
-
if len(base64Frames) >
|
63 |
-
raise gr.Warning(f"Video's play time is too long. (>
|
64 |
print(len(base64Frames), "frames read.")
|
65 |
|
66 |
if not base64Frames:
|
@@ -225,7 +225,10 @@ def main():
|
|
225 |
placeholder="sk-*********...",
|
226 |
lines=1
|
227 |
)
|
228 |
-
video_upload = gr.File(
|
|
|
|
|
|
|
229 |
# batch_size = gr.Number(
|
230 |
# label="Number of images in one batch",
|
231 |
# value=2,
|
@@ -234,9 +237,9 @@ def main():
|
|
234 |
# )
|
235 |
total_batch_percent = gr.Number(
|
236 |
label="Percentage(%) of batched image frames to total frames",
|
237 |
-
value=
|
238 |
-
minimum=
|
239 |
-
maximum=
|
240 |
step=5
|
241 |
)
|
242 |
process_button = gr.Button("Process")
|
|
|
49 |
|
50 |
def _process_video(image_file):
|
51 |
# Read and process the video file
|
52 |
+
video = cv2.VideoCapture(image_file.name)
|
53 |
|
54 |
base64Frames = []
|
55 |
while video.isOpened():
|
|
|
59 |
_, buffer = cv2.imencode(".jpg", frame)
|
60 |
base64Frames.append(base64.b64encode(buffer).decode("utf-8"))
|
61 |
video.release()
|
62 |
+
if len(base64Frames) > 700:
|
63 |
+
raise gr.Warning(f"Video's play time is too long. (>20s)")
|
64 |
print(len(base64Frames), "frames read.")
|
65 |
|
66 |
if not base64Frames:
|
|
|
225 |
placeholder="sk-*********...",
|
226 |
lines=1
|
227 |
)
|
228 |
+
video_upload = gr.File(
|
229 |
+
label="Upload your video (under 10 second video is the best..!)",
|
230 |
+
file_types=["video"],
|
231 |
+
)
|
232 |
# batch_size = gr.Number(
|
233 |
# label="Number of images in one batch",
|
234 |
# value=2,
|
|
|
237 |
# )
|
238 |
total_batch_percent = gr.Number(
|
239 |
label="Percentage(%) of batched image frames to total frames",
|
240 |
+
value=5,
|
241 |
+
minimum=5,
|
242 |
+
maximum=20,
|
243 |
step=5
|
244 |
)
|
245 |
process_button = gr.Button("Process")
|