Omar Khaled commited on
Commit
ef3ac96
·
verified ·
1 Parent(s): 4a3412d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -0
README.md CHANGED
@@ -36,6 +36,50 @@ See the official code, paper, and zenodo archive below. Their work has been acce
36
  [![Code](https://img.shields.io/badge/Code-black?style=flat-square&logo=github)](https://github.com/MehreenMehreen/muharaf) | [![Paper](https://img.shields.io/badge/Paper-black?style=flat-square&logo=arxiv)](https://arxiv.org/abs/2406.09630) | [![Dataset](https://img.shields.io/badge/Dataset-black?style=flat-square&logo=zenodo&logoColor=white&logoSize=auto)](https://zenodo.org/records/11492215)
37
  :-------------------------:|:-------------------------:|:----
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  # Citation
40
 
41
  If you are using this dataset in your work, please cite the official paper below.
 
36
  [![Code](https://img.shields.io/badge/Code-black?style=flat-square&logo=github)](https://github.com/MehreenMehreen/muharaf) | [![Paper](https://img.shields.io/badge/Paper-black?style=flat-square&logo=arxiv)](https://arxiv.org/abs/2406.09630) | [![Dataset](https://img.shields.io/badge/Dataset-black?style=flat-square&logo=zenodo&logoColor=white&logoSize=auto)](https://zenodo.org/records/11492215)
37
  :-------------------------:|:-------------------------:|:----
38
 
39
+ # How to use
40
+
41
+ ```python
42
+ from datasets import load_dataset
43
+ import matplotlib.pyplot as plt
44
+
45
+ # Load your dataset in streaming mode to be loaded faster
46
+ # https://huggingface.co/docs/datasets/v1.10.1/dataset_streaming.html
47
+
48
+ ds = load_dataset("Omarkhaledok/muharaf-public-pages", streaming=True)
49
+
50
+ # Take one sample from the training set
51
+
52
+ sample = next(iter(ds['train']))
53
+
54
+ # Number of samples to visualize
55
+
56
+ SAMPLE_SIZE=1
57
+
58
+ # Display the image using matplotlib
59
+
60
+ plt.imshow(sample['image'])
61
+ plt.axis('off') # Hide axes for better visualization
62
+ plt.show()
63
+
64
+ # Print the corresponding text
65
+
66
+ print("Corresponding text:")
67
+ print(sample['text'])
68
+
69
+ # # Example: iterate through 5 samples and visualize them
70
+ # # Uncode the following lines to visualize `SAMPLE_SIZE` of images and the corresponding text
71
+
72
+ # for i, sample in enumerate(ds['train']):
73
+ # if i >= SAMPLE_SIZE:
74
+ # break
75
+ # plt.imshow(sample['image'])
76
+ # plt.axis('off')
77
+ # plt.title(f"Sample {i+1}")
78
+ # plt.show()
79
+ # print("Text:", sample['text'])
80
+ # print("-"*50)
81
+
82
+ ```
83
  # Citation
84
 
85
  If you are using this dataset in your work, please cite the official paper below.