download with google drive added

This commit is contained in:
qwaezrx
2023-12-16 06:44:14 +09:00
parent b61438e92a
commit 7d1376721f
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -6,7 +6,7 @@ import torch
import comfy.sd
import comfy.utils
import folder_paths
from .s3_utils import download_file
from .s3_utils import download_file_from_s3_bucket, download_file_from_url
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
@@ -211,7 +211,10 @@ class S3Bucket_Load_LoRA:
if not os.path.exists(lora_path):
os.makedirs(Path(lora_path).parent)
lora_path = download_file(bucket_file_path=lora_name, download_path=lora_path)
if "drive.google" in lora_name:
lora_path = download_file_from_url(url=lora_name, download_path=lora_path)
else:
lora_path = download_file_from_s3_bucket(bucket_file_path=lora_name, download_path=lora_path)
if self.loaded_lora is not None:
if self.loaded_lora[0] == lora_path:
+1 -1
View File
@@ -104,7 +104,7 @@ def download_file_from_url(url, download_path):
print(f"Downloaded file {download_path}")
return download_path
def download_file(bucket_file_path, download_path, bucket_creds=None):
def download_file_from_s3_bucket(bucket_file_path, download_path, bucket_creds=None):
if not os.getenv("BUCKET_ACCESS_KEY_ID") or not os.getenv("BUCKET_SECRET_ACCESS_KEY"):
print("Bucket creds not provided. Try downloading with URL...")
lora_url = get_file_url(bucket_file_path)