Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions instill/helpers/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
EMBEDDING_TRUNCATE_END = "end"
EMBEDDING_TRUNCATE_START = "start"

HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 \
(KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
}


class VisionInput:
image: Image.Image
Expand Down
3 changes: 2 additions & 1 deletion instill/helpers/ray_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from starlette.requests import Request

from instill.helpers.const import (
HEADERS,
IMAGE_INPUT_TYPE_BASE64,
IMAGE_INPUT_TYPE_URL,
PROMPT_ROLES,
Expand Down Expand Up @@ -42,7 +43,7 @@ def base64_to_pil_image(base64_str):


def url_to_pil_image(url):
resp = requests.get(url, timeout=10)
resp = requests.get(url, headers=HEADERS, timeout=10)
resp.raise_for_status()
return Image.open(io.BytesIO(resp.content))

Expand Down