Spaces:
Sleeping
Sleeping
Omar ID EL MOUMEN
commited on
Commit
·
88cff0c
1
Parent(s):
743537e
Fixed random extraction
Browse files
app.py
CHANGED
|
@@ -95,10 +95,10 @@ async def extract_text_pdf(id_doc: str):
|
|
| 95 |
else:
|
| 96 |
print("ID: " + id_doc)
|
| 97 |
print("URL: " + f"http://arxiv.org/pdf/{id_doc}")
|
| 98 |
-
print("Status code: " + str(pdf_req.
|
| 99 |
return {"error": True, "message": "Error while downloading PDF: " + str(pdf_req.status_code)}
|
| 100 |
|
| 101 |
@app.get("/extract/random/{keyword}/{limit}")
|
| 102 |
async def extract_random_pdf(keyword: str, limit: int):
|
| 103 |
pubs = await get_articles(keyword, limit)
|
| 104 |
-
return await extract_text_pdf(random.choice(list(pubs.keys())))
|
|
|
|
| 95 |
else:
|
| 96 |
print("ID: " + id_doc)
|
| 97 |
print("URL: " + f"http://arxiv.org/pdf/{id_doc}")
|
| 98 |
+
print("Status code: " + str(pdf_req.status_code))
|
| 99 |
return {"error": True, "message": "Error while downloading PDF: " + str(pdf_req.status_code)}
|
| 100 |
|
| 101 |
@app.get("/extract/random/{keyword}/{limit}")
|
| 102 |
async def extract_random_pdf(keyword: str, limit: int):
|
| 103 |
pubs = await get_articles(keyword, limit)
|
| 104 |
+
return await extract_text_pdf(random.choice(list(pubs["message"].keys())))
|