Spaces:
Sleeping
Sleeping
Delete tools/file_loader.py
Browse files- tools/file_loader.py +0 -14
tools/file_loader.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
import io
|
| 2 |
-
import pandas as pd
|
| 3 |
-
from PyPDF2 import PdfReader
|
| 4 |
-
|
| 5 |
-
def read_pdf(file_bytes):
|
| 6 |
-
reader = PdfReader(io.BytesIO(file_bytes))
|
| 7 |
-
return "\n".join(page.extract_text() for page in reader.pages if page.extract_text())
|
| 8 |
-
|
| 9 |
-
def read_csv(file_bytes):
|
| 10 |
-
df = pd.read_csv(io.BytesIO(file_bytes))
|
| 11 |
-
return df.to_string()
|
| 12 |
-
|
| 13 |
-
def read_txt(file_bytes):
|
| 14 |
-
return file_bytes.decode("utf-8")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|