From 35823b09334c1206a2fc08d17999419a16a7b922 Mon Sep 17 00:00:00 2001 From: JE-Chen <33644111+JE-Chen@users.noreply.github.com> Date: Wed, 25 Oct 2023 09:53:27 +0800 Subject: [PATCH] Update version and test --- stable.toml => dev.toml | 4 ++-- pyproject.toml | 4 ++-- re_edge_gpt/__init__.py | 4 ++-- re_edge_gpt/image_genearation.py | 8 ++++---- test/unit_test/test_generate_image/test_generation.py | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) rename stable.toml => dev.toml (95%) diff --git a/stable.toml b/dev.toml similarity index 95% rename from stable.toml rename to dev.toml index d089350..520680e 100644 --- a/stable.toml +++ b/dev.toml @@ -5,8 +5,8 @@ requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] -name = "re_edge_gpt" -version = "0.0.13" +name = "re_edge_gpt_dev" +version = "0.0.14" authors = [ { name = "JE-Chen", email = "jechenmailman@gmail.com" }, ] diff --git a/pyproject.toml b/pyproject.toml index 738b916..d28fe44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,8 +5,8 @@ requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] -name = "re_edge_gpt_dev" -version = "0.0.13" +name = "re_edge_gpt" +version = "0.0.14" authors = [ { name = "JE-Chen", email = "jechenmailman@gmail.com" }, ] diff --git a/re_edge_gpt/__init__.py b/re_edge_gpt/__init__.py index 2dfdf59..6dc3491 100644 --- a/re_edge_gpt/__init__.py +++ b/re_edge_gpt/__init__.py @@ -1,7 +1,7 @@ -from re_edge_gpt.re_edge_gpt import Chatbot -from re_edge_gpt.re_edge_gpt import ConversationStyle from re_edge_gpt.image_genearation import ImageGen from re_edge_gpt.image_genearation import ImageGenAsync +from re_edge_gpt.re_edge_gpt import Chatbot +from re_edge_gpt.re_edge_gpt import ConversationStyle __all__ = [ "Chatbot", "ConversationStyle", "ImageGen", "ImageGenAsync" diff --git a/re_edge_gpt/image_genearation.py b/re_edge_gpt/image_genearation.py index da92876..ab03fe5 100644 --- a/re_edge_gpt/image_genearation.py +++ b/re_edge_gpt/image_genearation.py @@ -138,7 +138,7 @@ def get_images(self, prompt: str) -> Union[list, None]: url = f"{BING_URL}/images/create?q={url_encoded_prompt}&rt=3&FORM=GUH2CR" response = self.session.post(url, allow_redirects=False, timeout=200) if response.status_code != 302: - print("Image Creating Please Retry Later", end="", flush=True) + print("Image create failed pls check cookie or old image still creating", flush=True) return # Get redirect URL redirect_url = response.headers["Location"].replace("&nfy=1", "") @@ -310,9 +310,9 @@ async def get_images(self, prompt: str) -> Union[list, None]: follow_redirects=False, timeout=200, ) - if response.status_code != 302: - print("Image Creating Please Retry Later", end="", flush=True) - return None + if response.status_code != 302: + print("Image create failed pls check cookie or old image still creating", flush=True) + return None # Get redirect URL redirect_url = response.headers["Location"].replace("&nfy=1", "") request_id = redirect_url.split("id=")[-1] diff --git a/test/unit_test/test_generate_image/test_generation.py b/test/unit_test/test_generate_image/test_generation.py index 3a2e653..8984772 100644 --- a/test/unit_test/test_generate_image/test_generation.py +++ b/test/unit_test/test_generate_image/test_generation.py @@ -29,7 +29,7 @@ def test_generate_image_sync(): # Generate image list async async def test_generate_image_async(): - image_list = await async_gen.get_images("Big, Golden, Tree") + image_list = await async_gen.get_images("La Tour Eiffel") print(image_list)