Update processing_videollama3.py
Browse files
processing_videollama3.py
CHANGED
|
@@ -9,6 +9,7 @@ from collections import defaultdict
|
|
| 9 |
from typing import Any, List, Union, Dict, Optional, Tuple, TypedDict
|
| 10 |
|
| 11 |
import cv2
|
|
|
|
| 12 |
import ffmpeg
|
| 13 |
import imageio
|
| 14 |
import json
|
|
@@ -298,6 +299,8 @@ class Videollama3Qwen2Processor(ProcessorMixin):
|
|
| 298 |
elif isinstance(image_path, str) and os.path.isdir(image_path):
|
| 299 |
# images = [cv2.cvtColor(cv2.imread(os.path.join(image_path, f)), cv2.COLOR_BGR2RGB) for f in sorted(os.listdir(image_path))]
|
| 300 |
images = [Image.open(os.path.join(image_path, f)).convert('RGB') for f in sorted(os.listdir(image_path))]
|
|
|
|
|
|
|
| 301 |
elif isinstance(image_path, list) and isinstance(image_path[0], str):
|
| 302 |
# images = [cv2.cvtColor(cv2.imread(f), cv2.COLOR_BGR2RGB) for f in image_path]
|
| 303 |
images = [Image.open(f).convert('RGB') for f in image_path]
|
|
|
|
| 9 |
from typing import Any, List, Union, Dict, Optional, Tuple, TypedDict
|
| 10 |
|
| 11 |
import cv2
|
| 12 |
+
import requests
|
| 13 |
import ffmpeg
|
| 14 |
import imageio
|
| 15 |
import json
|
|
|
|
| 299 |
elif isinstance(image_path, str) and os.path.isdir(image_path):
|
| 300 |
# images = [cv2.cvtColor(cv2.imread(os.path.join(image_path, f)), cv2.COLOR_BGR2RGB) for f in sorted(os.listdir(image_path))]
|
| 301 |
images = [Image.open(os.path.join(image_path, f)).convert('RGB') for f in sorted(os.listdir(image_path))]
|
| 302 |
+
elif isinstance(image_path, str) and image_path.startswith("http://") or image_path.startswith("https://"):
|
| 303 |
+
images = [Image.open(requests.get(image, stream=True).raw)]
|
| 304 |
elif isinstance(image_path, list) and isinstance(image_path[0], str):
|
| 305 |
# images = [cv2.cvtColor(cv2.imread(f), cv2.COLOR_BGR2RGB) for f in image_path]
|
| 306 |
images = [Image.open(f).convert('RGB') for f in image_path]
|