From a28bab938704a15c825c1b45a8983c72e8c90ace Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 29 Jan 2024 18:14:46 +0100 Subject: Add aiohttp_socks to requirements Fix preview for uploaded and generated images in gui Improve typing, readme --- g4f/typing.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'g4f/typing.py') diff --git a/g4f/typing.py b/g4f/typing.py index c5a981bd..386b3dfc 100644 --- a/g4f/typing.py +++ b/g4f/typing.py @@ -1,9 +1,10 @@ import sys from typing import Any, AsyncGenerator, Generator, NewType, Tuple, Union, List, Dict, Type, IO, Optional + try: from PIL.Image import Image except ImportError: - Image = type + from typing import Type as Image if sys.version_info >= (3, 8): from typing import TypedDict @@ -14,7 +15,7 @@ SHA256 = NewType('sha_256_hash', str) CreateResult = Generator[str, None, None] AsyncResult = AsyncGenerator[str, None] Messages = List[Dict[str, str]] -Cookies = List[Dict[str, str]] +Cookies = Dict[str, str] ImageType = Union[str, bytes, IO, Image, None] __all__ = [ @@ -33,5 +34,7 @@ __all__ = [ 'CreateResult', 'AsyncResult', 'Messages', + 'Cookies', + 'Image', 'ImageType' ] -- cgit v1.2.3