diff --git a/examples/image_generation/gpt_functions.py b/examples/image_generation/gpt_functions.py index 7cf1f41..bb4fcdb 100644 --- a/examples/image_generation/gpt_functions.py +++ b/examples/image_generation/gpt_functions.py @@ -65,7 +65,7 @@ def draw_image_using_dalle(prompt): dalle = DALLE(auth_token=oai_token, organization=oai_organization) image = dalle.create_image_url(prompt) url_dict = {"image_url": image[0]} - response = requests.get(image[0]) + response = requests.get(image[0], timeout=30) img = Image.open(BytesIO(response.content)) img.show() return json.dumps(url_dict) @@ -90,7 +90,7 @@ def draw_image(prompt): ) response = leonardo.wait_for_image_generation(generation_id=response["sdGenerationJob"]["generationId"]) url_dict = {"image_url": response[0]["url"]} - response = requests.get(url_dict["image_url"]) + response = requests.get(url_dict["image_url"], timeout=30) img = Image.open(BytesIO(response.content)) img.show() return json.dumps(url_dict) diff --git a/utils/page_retriever.py b/utils/page_retriever.py index 850dcf3..94766bf 100644 --- a/utils/page_retriever.py +++ b/utils/page_retriever.py @@ -74,7 +74,6 @@ def get_body_without_scripts(self, url=None): Get the body content of the page without tags. :param url: (str) URL of the page. - :return: (str) Body content of the page without tags. """ if url: @@ -86,7 +85,6 @@ def get_page_content(self, url): Get the page content from the url. :param url: (str) URL of the page. - :return: (str) HTML content of the page. """ self.driver.get(url) @@ -114,7 +112,6 @@ def extract_body_content(html_content): Extract the body content from the html_content. :param html_content: (str) HTML content of the page. - :return: (str) Body content of the page. """ soup = BeautifulSoup(html_content, "html.parser") @@ -128,7 +125,6 @@ def remove_script_tags(input_content): Remove all tags from the input_content. :param input_content: (str) HTML content of the page. - :return: (str) Body content of the page without tags. """ pattern_1 = re.compile(r".*?", re.DOTALL)