Spaces:
Sleeping
Sleeping
rmm
commited on
Commit
·
be5e8dd
1
Parent(s):
60a7864
fix: typehints compatible with py3.9
Browse files
src/input/input_validator.py
CHANGED
@@ -1,13 +1,13 @@
|
|
|
|
1 |
import random
|
2 |
import string
|
3 |
import hashlib
|
4 |
import re
|
5 |
-
import streamlit as st
|
6 |
from fractions import Fraction
|
7 |
-
|
8 |
from PIL import Image
|
9 |
from PIL import ExifTags
|
10 |
|
|
|
11 |
from streamlit.runtime.uploaded_file_manager import UploadedFile
|
12 |
|
13 |
def generate_random_md5(length:int=16) -> str:
|
@@ -60,7 +60,7 @@ def is_valid_email(email:str) -> bool:
|
|
60 |
|
61 |
|
62 |
# Function to extract date and time from image metadata
|
63 |
-
def get_image_datetime(image_file:UploadedFile) -> str
|
64 |
"""
|
65 |
Extracts the original date and time from the EXIF metadata of an uploaded image file.
|
66 |
|
@@ -112,8 +112,9 @@ def decimal_coords(coords:tuple, ref:str) -> Fraction:
|
|
112 |
return decimal_degrees
|
113 |
|
114 |
|
115 |
-
#def get_image_latlon(image_file: UploadedFile)
|
116 |
-
def get_image_latlon(image_file: UploadedFile) :
|
|
|
117 |
"""
|
118 |
Extracts the latitude and longitude from the EXIF metadata of an uploaded image file.
|
119 |
|
|
|
1 |
+
from typing import Tuple, Union
|
2 |
import random
|
3 |
import string
|
4 |
import hashlib
|
5 |
import re
|
|
|
6 |
from fractions import Fraction
|
|
|
7 |
from PIL import Image
|
8 |
from PIL import ExifTags
|
9 |
|
10 |
+
import streamlit as st
|
11 |
from streamlit.runtime.uploaded_file_manager import UploadedFile
|
12 |
|
13 |
def generate_random_md5(length:int=16) -> str:
|
|
|
60 |
|
61 |
|
62 |
# Function to extract date and time from image metadata
|
63 |
+
def get_image_datetime(image_file:UploadedFile) -> Union[str, None]:
|
64 |
"""
|
65 |
Extracts the original date and time from the EXIF metadata of an uploaded image file.
|
66 |
|
|
|
112 |
return decimal_degrees
|
113 |
|
114 |
|
115 |
+
#def get_image_latlon(image_file: UploadedFile) : # if it is still not working
|
116 |
+
#def get_image_latlon(image_file: UploadedFile) -> Tuple[float, float] | None: # Python >=3.10
|
117 |
+
def get_image_latlon(image_file: UploadedFile) -> Union[Tuple[float, float], None]: # 3.6 <= Python < 3.10
|
118 |
"""
|
119 |
Extracts the latitude and longitude from the EXIF metadata of an uploaded image file.
|
120 |
|