Spaces:
Sleeping
Sleeping
File size: 547 Bytes
d75dae7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from pdfminer.high_level import extract_text
from smolagents import Tool
class PdfReaderTool(Tool):
name = "pdf_reader"
description = "Extract PDF content. Supported file extensions: .pdf"
inputs = {
"file_path": {
"type": "string",
"description": "Path to the PDF file",
}
}
output_type = "string"
def forward(self, file_path) -> str:
try:
return extract_text(file_path)
except Exception as e:
return f"Error processing PDF file: {str(e)}"
|