mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-07 15:52:32 +08:00
Switch to urllib to avoid extra dependency
This commit is contained in:
parent
df03f38556
commit
f981efed75
7
nodes.py
7
nodes.py
@ -10,7 +10,7 @@ import traceback
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
from PIL.PngImagePlugin import PngInfo
|
from PIL.PngImagePlugin import PngInfo
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import requests
|
from urllib import request
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
|
||||||
|
|
||||||
@ -954,9 +954,8 @@ class LoadImageUrl:
|
|||||||
CATEGORY = "image"
|
CATEGORY = "image"
|
||||||
|
|
||||||
def load_image(self, url):
|
def load_image(self, url):
|
||||||
r = requests.get(url, stream=True)
|
r = request.urlopen(url)
|
||||||
r.raise_for_status()
|
i = Image.open(r)
|
||||||
i = Image.open(r.raw)
|
|
||||||
image = i.convert("RGB")
|
image = i.convert("RGB")
|
||||||
image = np.array(image).astype(np.float32) / 255.0
|
image = np.array(image).astype(np.float32) / 255.0
|
||||||
image = torch.from_numpy(image)[None,]
|
image = torch.from_numpy(image)[None,]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user