Monet Joe commited on
Commit
6f6a97b
1 Parent(s): ab8f1c6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +27 -5
README.md CHANGED
@@ -21,16 +21,38 @@ GIT_LFS_SKIP_SMUDGE=1 git clone git@hf.co:datasets/MuGeminorum/svhn
21
 
22
  ## Usage
23
  ```python
24
- from datasets import load_dataset
 
 
25
 
26
- dataset = load_dataset("MuGeminorum/svhn")
27
 
28
- for item in dataset['train']:
29
- print(item)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  ```
31
 
32
  ## Mirror
33
  <https://www.modelscope.cn/datasets/MuGeminorum/svhn>
34
 
35
  ## Reference
36
- <a href="http://ufldl.stanford.edu/housenumbers">The Street View House Numbers (SVHN) Dataset</a>
 
21
 
22
  ## Usage
23
  ```python
24
+ import os
25
+ import zipfile
26
+ import requests
27
 
 
28
 
29
+ def download_file(url, save_path):
30
+ response = requests.get(url, stream=True)
31
+ response.raise_for_status()
32
+ with open(save_path, 'wb') as file:
33
+ for chunk in response.iter_content(chunk_size=1024):
34
+ if chunk:
35
+ file.write(chunk)
36
+
37
+
38
+ def unzip(zip_file_path, extract_to):
39
+ with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:
40
+ for member in zip_ref.infolist():
41
+ zip_ref.extract(member, extract_to)
42
+
43
+
44
+ if not os.path.exists('./data.zip'):
45
+ download_file(
46
+ 'https://huggingface.co/datasets/MuGeminorum/svhn/resolve/main/data.zip',
47
+ 'data.zip'
48
+ )
49
+
50
+ if not os.path.exists('./data'):
51
+ unzip('data.zip', './')
52
  ```
53
 
54
  ## Mirror
55
  <https://www.modelscope.cn/datasets/MuGeminorum/svhn>
56
 
57
  ## Reference
58
+ [1] <a href="http://ufldl.stanford.edu/housenumbers">The Street View House Numbers (SVHN) Dataset</a>