sijpapi commited on
Commit
959d2c1
·
1 Parent(s): e7287fb

Update batch13.py

Browse files
Files changed (1) hide show
  1. batch13.py +11 -1
batch13.py CHANGED
@@ -32,6 +32,13 @@ def normalize_bbox(bbox, size):
32
  int(1000 * bbox[2] / size[0]),
33
  int(1000 * bbox[3] / size[1]),
34
  ]
 
 
 
 
 
 
 
35
  class FunsdConfig(datasets.BuilderConfig):
36
  """BuilderConfig for FUNSD"""
37
  def __init__(self, **kwargs):
@@ -81,7 +88,10 @@ class Funsd(datasets.GeneratorBasedBuilder):
81
  url = 'https://modeldocuments.s3.ap-southeast-1.amazonaws.com/datafiles.zip'
82
  #url = 's3://modeldocuments/datafiles.zip'
83
 
84
- downloaded_file = dl_manager.download_and_extract(url)
 
 
 
85
  return [
86
  datasets.SplitGenerator(
87
  name=datasets.Split.TRAIN, gen_kwargs={"filepath": f"{downloaded_file}/data/training_data/"}
 
32
  int(1000 * bbox[2] / size[0]),
33
  int(1000 * bbox[3] / size[1]),
34
  ]
35
+
36
+ def custom_download(url):
37
+ import boto3
38
+ s3 = boto3.client('s3')
39
+ s3.download_file('modeldocuments', url, url)
40
+
41
+
42
  class FunsdConfig(datasets.BuilderConfig):
43
  """BuilderConfig for FUNSD"""
44
  def __init__(self, **kwargs):
 
88
  url = 'https://modeldocuments.s3.ap-southeast-1.amazonaws.com/datafiles.zip'
89
  #url = 's3://modeldocuments/datafiles.zip'
90
 
91
+ #downloaded_file = dl_manager.download_and_extract(url)
92
+ downloaded_file = dl_manager.download_custom(url, custom_download)
93
+ downloaded_file = dl_manager.extract(downloaded_file)
94
+
95
  return [
96
  datasets.SplitGenerator(
97
  name=datasets.Split.TRAIN, gen_kwargs={"filepath": f"{downloaded_file}/data/training_data/"}