File size: 716 Bytes
3a3bb19
 
a5cb4ef
3a3bb19
71e4505
 
a5cb4ef
55315c3
a5cb4ef
55315c3
a5cb4ef
 
 
 
71e4505
a5cb4ef
 
 
 
55315c3
a5cb4ef
 
 
 
 
55315c3
a5cb4ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

import os
import requests, zipfile, io

IMAGE_DIR = 'flickr30k_images/flickr30k_images'

def downlad_images() :

    zip_file = 'data/flickr.zip'

    #TODO : zip_file_url?
    zip_file_url = 'https://drive.google.com/open?id=14QhofCbby053kWbVeWEBHCxOROQS-bjN&authuser=0'

    try :
        if not os.path.exists(IMAGE_DIR) :
            if not os.path.exists(zip_file) :
                r = requests.get(zip_file_url)
                z = zipfile.ZipFile(io.BytesIO(r.content))
                z.extractall(".")

            else :
                with zipfile.ZipFile(zip_file, 'r') as zip_ref:
                    zip_ref.extractall(".")
    except :
        print("Problems with image file download")

    return