Spaces:
Runtime error
Runtime error
Update utility/utils.py
Browse files- utility/utils.py +2 -10
utility/utils.py
CHANGED
@@ -47,21 +47,13 @@ client = InferenceClient(model="mistralai/Mistral-7B-Instruct-v0.3", token=HFT)
|
|
47 |
|
48 |
# Load image using OpenCV
|
49 |
def load_image(image_path):
|
50 |
-
ext = os.path.splitext(
|
51 |
-
if ext in ['.png', '.jpg', '.jpeg']:
|
52 |
image = cv2.imread(image_path)
|
53 |
return image
|
54 |
else:
|
55 |
raise ValueError(f"Could not load image from {image_path}. It may be corrupted or the path is incorrect. or in a not supported format")
|
56 |
|
57 |
-
def extract_hyperlinks(file_path):
|
58 |
-
ext = os.path.splitext(file_path)[1].lower()
|
59 |
-
|
60 |
-
if ext in ['.png', '.jpg', '.jpeg']:
|
61 |
-
return 'Not Supported'
|
62 |
-
else:
|
63 |
-
raise ValueError("Unsupported file format")
|
64 |
-
|
65 |
# Function for upscaling image using OpenCV's INTER_CUBIC
|
66 |
def upscale_image(image, scale=2):
|
67 |
height, width = image.shape[:2]
|
|
|
47 |
|
48 |
# Load image using OpenCV
|
49 |
def load_image(image_path):
|
50 |
+
ext = os.path.splitext(image_path)[1].lower()
|
51 |
+
if ext in ['.png', '.jpg', '.jpeg', '.webp', '.tiff']:
|
52 |
image = cv2.imread(image_path)
|
53 |
return image
|
54 |
else:
|
55 |
raise ValueError(f"Could not load image from {image_path}. It may be corrupted or the path is incorrect. or in a not supported format")
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
# Function for upscaling image using OpenCV's INTER_CUBIC
|
58 |
def upscale_image(image, scale=2):
|
59 |
height, width = image.shape[:2]
|