Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Commit

Permalink
Use svglib
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Cheong committed Dec 11, 2022
1 parent a33a0f6 commit 05d92e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
install_requires=[
"httpx",
"OpenAIAuth>=0.0.6",
"cairosvg"
"reportlab",
"svglib"
],
long_description=open("README.md", encoding="utf-8").read(),
long_description_content_type="text/markdown",
Expand Down
7 changes: 5 additions & 2 deletions src/revChatGPT/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
from os.path import exists
from os import getenv
from sys import argv, exit
from cairosvg import svg2png
from io import BytesIO
from svglib.svglib import svg2rlg
from reportlab.graphics import renderPM

from revChatGPT.revChatGPT import Chatbot

Expand All @@ -27,7 +29,8 @@ def solve_captcha(raw_svg):
svg = raw_svg
# Save the SVG
print("Saved captcha.png")
svg2png(bytestring=svg, write_to="captcha.png")
drawing = svg2rlg(BytesIO(svg))
renderPM.drawToFile(drawing, "captcha.png", fmt="PNG", dpi=300)
# Get input
solution = input("Please solve the captcha: ")
# Return the solution
Expand Down

0 comments on commit 05d92e3

Please sign in to comment.