Test Write PDF Text
This commit is contained in:
@@ -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
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -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():
|
||||||
|
|||||||
Reference in New Issue
Block a user