Descomento linea de modificacion parquet y agrego instruccion para borrar imagenes luego de agregarse al dataset
Browse files
main.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
# pandas: For data manipulation and transformation.
|
2 |
# pyarrow: For reading and writing Parquet files.
|
3 |
import pyarrow.parquet as pq
|
|
|
4 |
import json
|
5 |
|
6 |
table = pq.read_table('data/test-00000-of-00001.parquet')
|
@@ -19,6 +20,7 @@ for img in image_rows:
|
|
19 |
image_bytes = image.read()
|
20 |
new_row = {'image': {'bytes': image_bytes, 'path': image_path}, 'text': image_text}
|
21 |
df = df._append(new_row, ignore_index=True)
|
|
|
22 |
|
23 |
print("FIN", df)
|
24 |
-
|
|
|
1 |
# pandas: For data manipulation and transformation.
|
2 |
# pyarrow: For reading and writing Parquet files.
|
3 |
import pyarrow.parquet as pq
|
4 |
+
import os
|
5 |
import json
|
6 |
|
7 |
table = pq.read_table('data/test-00000-of-00001.parquet')
|
|
|
20 |
image_bytes = image.read()
|
21 |
new_row = {'image': {'bytes': image_bytes, 'path': image_path}, 'text': image_text}
|
22 |
df = df._append(new_row, ignore_index=True)
|
23 |
+
os.remove(image_path)
|
24 |
|
25 |
print("FIN", df)
|
26 |
+
df.to_parquet('data/test-00000-of-00001.parquet')
|