Simple-image-to-3d / utils.py
Felguk's picture
Create utils.py
ff65975 verified
raw
history blame contribute delete
419 Bytes
import os
def create_output_directory(directory="output"):
"""Create output directory if it doesn't exist"""
if not os.path.exists(directory):
os.makedirs(directory)
return directory
def allowed_file(filename):
"""Check if file has allowed extension"""
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'}
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS