Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -12,13 +12,14 @@ except:
12
  pass
13
 
14
  auth_token = os.environ.get('HF_TOKEN', None)
15
- if not auth_token:
16
- raise ValueError("could not authenticate the user.")
17
 
18
- iiw_400 = load_dataset('google/imageinwords', token=auth_token, trust_remote_code=True, name="IIW-400")
19
- docci_test = load_dataset('google/imageinwords', token=auth_token, trust_remote_code=True, name="DOCCI_Test")
20
- locnar_eval = load_dataset('google/imageinwords', token=auth_token, trust_remote_code=True, name="LocNar_Eval")
21
- cm_3600 = load_dataset('google/imageinwords', token=auth_token, trust_remote_code=True, name="CM_3600")
 
 
 
22
 
23
  _SELECTOR_TO_DATASET = {
24
  "IIW-400": iiw_400,
@@ -36,7 +37,7 @@ def display_iiw_data_with_slider_change(dataset_type, index):
36
  image_url_key = "image/thumbnail_url"
37
  image_key = "image"
38
 
39
- logging.warning(f"SELECTION: {dataset_type} : {dataset_split}: {index}")
40
  data = _SELECTOR_TO_DATASET[dataset_type][dataset_split][index]
41
  image_html = f'<img src="{data[image_url_key]}" style="width:100%; max-width:800px; height:auto;">'
42
  image_key_html = f"<p style='font-size: 10px'>Image Key: {data[image_key]}</p>"
@@ -78,7 +79,7 @@ def max_index(dataset_type):
78
  if dataset_type == "LocNar_Eval":
79
  dataset_split = "validation"
80
 
81
- logging.warning(f"SELECTION: {dataset_type} : {dataset_split}")
82
  dataset_instance =_SELECTOR_TO_DATASET[dataset_type][dataset_split]
83
  return len(dataset_instance)
84
 
 
12
  pass
13
 
14
  auth_token = os.environ.get('HF_TOKEN', None)
 
 
15
 
16
+ try:
17
+ iiw_400 = load_dataset('google/imageinwords', token=auth_token, trust_remote_code=True, name="IIW-400")
18
+ docci_test = load_dataset('google/imageinwords', token=auth_token, trust_remote_code=True, name="DOCCI_Test")
19
+ locnar_eval = load_dataset('google/imageinwords', token=auth_token, trust_remote_code=True, name="LocNar_Eval")
20
+ cm_3600 = load_dataset('google/imageinwords', token=auth_token, trust_remote_code=True, name="CM_3600")
21
+ except Exception as e:
22
+ logging.error("could you fetch the datasets with error: %s", e)
23
 
24
  _SELECTOR_TO_DATASET = {
25
  "IIW-400": iiw_400,
 
37
  image_url_key = "image/thumbnail_url"
38
  image_key = "image"
39
 
40
+ logging.debug(f"SELECTION: {dataset_type} : {dataset_split}: {index}")
41
  data = _SELECTOR_TO_DATASET[dataset_type][dataset_split][index]
42
  image_html = f'<img src="{data[image_url_key]}" style="width:100%; max-width:800px; height:auto;">'
43
  image_key_html = f"<p style='font-size: 10px'>Image Key: {data[image_key]}</p>"
 
79
  if dataset_type == "LocNar_Eval":
80
  dataset_split = "validation"
81
 
82
+ logging.debug(f"SELECTION: {dataset_type} : {dataset_split}")
83
  dataset_instance =_SELECTOR_TO_DATASET[dataset_type][dataset_split]
84
  return len(dataset_instance)
85