Skip to content

Commit

Permalink
0.2 - fix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
wwakabobik committed Nov 2, 2023
1 parent a02839e commit 8b34f90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/image_generation/gpt_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions utils/page_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def get_body_without_scripts(self, url=None):
Get the body content of the page without <script>...</script> tags.
:param url: (str) URL of the page.
:return: (str) Body content of the page without <script>...</script> tags.
"""
if url:
Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -128,7 +125,6 @@ def remove_script_tags(input_content):
Remove all <script>...</script> tags from the input_content.
:param input_content: (str) HTML content of the page.
:return: (str) Body content of the page without <script>...</script> tags.
"""
pattern_1 = re.compile(r"<script.*?>.*?</script>", re.DOTALL)
Expand Down

0 comments on commit 8b34f90

Please sign in to comment.