Test Write PDF Text

This commit is contained in:
2023-03-17 23:51:49 -04:00
parent c5ce1629ef
commit 14c7249083
2 changed files with 11 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
wantedBy = ["networking-online.target"]; wantedBy = ["networking-online.target"];
enable = true; enable = true;
serviceConfig = { serviceConfig = {
WorkingDirectory = "handyhelper";
ExecStart = '' ExecStart = ''
${handy_py}/bin/handyhelper ${handy_py}/bin/handyhelper
''; '';

View File

@@ -43,6 +43,10 @@ async def getPDF(url):
resp = req.get(url, stream=True) resp = req.get(url, stream=True)
pdf = io.BytesIO(resp.content) pdf = io.BytesIO(resp.content)
pages = pdftotext.PDF(pdf) pages = pdftotext.PDF(pdf)
with open("./test.txt","w") as f:
f.write("\n\n".join(pages))
return "\n\n".join(pages) return "\n\n".join(pages)
async def summarize(pdf): async def summarize(pdf):
@@ -53,9 +57,13 @@ async def summarize(pdf):
--- ---
{pdf} {pdf}
"""} """}
] ],
user="HandyHelper"
) )
return completion
eprint(completion.usage)
return completion.choices[0].message
@bot.event @bot.event
async def on_ready(): async def on_ready():