Spaces:
Sleeping
Sleeping
Import PyPDF2
Browse files
app.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
|
@@ -21,7 +22,7 @@ def extract_text_from_pdf(file_path: str) -> str:
|
|
| 21 |
|
| 22 |
# Check if text was extracted
|
| 23 |
if text:
|
| 24 |
-
return f"Extracted text from the PDF: {text[:500]}" #
|
| 25 |
else:
|
| 26 |
return "No text found in the PDF."
|
| 27 |
except Exception as e:
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
+
import PyPDF2
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
|
|
|
| 22 |
|
| 23 |
# Check if text was extracted
|
| 24 |
if text:
|
| 25 |
+
return f"Extracted text from the PDF: {text[:500]}" # Show first 500 caracters
|
| 26 |
else:
|
| 27 |
return "No text found in the PDF."
|
| 28 |
except Exception as e:
|