tohid.abedini
commited on
Commit
·
744607e
1
Parent(s):
c8e1af0
[Add] jsonl load handling
Browse files
utils.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import pandas as pd
|
| 2 |
-
|
| 3 |
|
| 4 |
custom_css = """
|
| 5 |
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn&display=swap');
|
|
@@ -143,7 +143,7 @@ def load_jsonl_with_check(file_path):
|
|
| 143 |
with open(file_path, 'r', encoding='utf-8') as file:
|
| 144 |
for idx, line in enumerate(file):
|
| 145 |
try:
|
| 146 |
-
data.append(
|
| 147 |
except ValueError as e:
|
| 148 |
print(f"Error parsing line {idx + 1}: {line.strip()}")
|
| 149 |
print(f"Error details: {e}")
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
+
import json
|
| 3 |
|
| 4 |
custom_css = """
|
| 5 |
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn&display=swap');
|
|
|
|
| 143 |
with open(file_path, 'r', encoding='utf-8') as file:
|
| 144 |
for idx, line in enumerate(file):
|
| 145 |
try:
|
| 146 |
+
data.append(json.loads(line.strip())) # Use json.loads instead of pd.json.loads
|
| 147 |
except ValueError as e:
|
| 148 |
print(f"Error parsing line {idx + 1}: {line.strip()}")
|
| 149 |
print(f"Error details: {e}")
|