Seeker38 commited on
Commit
152035c
1 Parent(s): 17b976e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +15 -5
README.md CHANGED
@@ -65,13 +65,16 @@ Researchers and developers can utilize this dataset for various tasks such as:
65
  - Text length imbalance: the longest text has the length of 8903 whereas the shortest is 1. This can create a situation of highly ram usage with using LSTM model,etc..
66
 
67
  ### View dataset:
68
- <b>For direct use instead of downloading the dataset to local</b>
 
 
69
  ```python
70
  from datasets import load_dataset
71
  dataset = load_dataset("Seeker38/image_text_wikipedia_vi", split="train")
72
  ```
 
73
 
74
- <b>For dataset that has been downloaded to local</b>
75
  ```python
76
  import pandas as pd
77
  from datasets import Dataset
@@ -82,15 +85,19 @@ df = pd.read_parquet(parquet_file)
82
  # Convert the pandas DataFrame to a datasets.arrow_dataset.Dataset object
83
  dataset = Dataset.from_pandas(df)
84
  ```
85
- <b>To view the third element's text</b>
 
86
  ```python
 
87
  dataset[3]["text"]
88
  ```
89
- <b>To view,or even use for training the third element's image, you need to contain the convertion step</b>
 
90
  ```python
91
  from PIL import Image
92
  import io
93
 
 
94
  image_bytes = dataset[3]["image"]["bytes"]
95
 
96
  # Convert bytes to Image
@@ -100,4 +107,7 @@ image_rgb = image.convert("RGB") # some images have error: ValueError: Could not
100
  image_rgb
101
  ```
102
 
103
- ##### you can use the link from this <b>[Google Colab](https://colab.research.google.com/drive/1Pxu1FTRnQMDlDJVEho5CmgglB1-IdEn9?usp=sharing)</b> to see a little viewing demo.
 
 
 
 
65
  - Text length imbalance: the longest text has the length of 8903 whereas the shortest is 1. This can create a situation of highly ram usage with using LSTM model,etc..
66
 
67
  ### View dataset:
68
+ There are 2 ways to load dataset:
69
+
70
+ <b>1. Use datasets library instead of downloading the dataset to local</b>
71
  ```python
72
  from datasets import load_dataset
73
  dataset = load_dataset("Seeker38/image_text_wikipedia_vi", split="train")
74
  ```
75
+ ##### you can use the link from this <b>[Google Colab](https://colab.research.google.com/drive/1BOAEsiVXNGm__vhZ4v_oyqytweG3JTm_?usp=sharing)</b> to see a little viewing demo.
76
 
77
+ <b>2. For dataset that has been downloaded to local</b>
78
  ```python
79
  import pandas as pd
80
  from datasets import Dataset
 
85
  # Convert the pandas DataFrame to a datasets.arrow_dataset.Dataset object
86
  dataset = Dataset.from_pandas(df)
87
  ```
88
+
89
+ <b>To view the element's text</b>
90
  ```python
91
+ # Example: element number 3
92
  dataset[3]["text"]
93
  ```
94
+
95
+ <b>If you use the 2nd way, then to view,or even use for training the element's image, you need to contain the convertion step</b>
96
  ```python
97
  from PIL import Image
98
  import io
99
 
100
+ # Example: element number 3
101
  image_bytes = dataset[3]["image"]["bytes"]
102
 
103
  # Convert bytes to Image
 
107
  image_rgb
108
  ```
109
 
110
+ <b>Else</b>
111
+ ```python
112
+ dataset[2]["image"]
113
+ ```