mcarthuradal commited on
Commit
1f33b02
1 Parent(s): 7faa66d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -13
app.py CHANGED
@@ -14,24 +14,20 @@ login(token=HF_TOKEN, add_to_git_credential=True)
14
 
15
 
16
  def stream_dataset_from_hub(split):
17
- dataset = load_dataset('mcarthuradal/arm-unicef',
18
- data_dir='images',
19
- split=split,
20
- streaming=True)
21
- return dataset
22
 
23
 
24
- dataset = stream_dataset_from_hub('train')
25
 
26
 
27
- def get_images(path: str | Path) :
28
- # filenames = os.listdir(path)
29
-
30
- # image_names = [filename for filename in filenames if filename.endswith('.tif')]
31
  n = 50
32
- image_batch = dataset.iter(n)
33
 
34
- yield image_batch
35
 
36
 
37
  iface = gr.Interface(fn=get_images,
@@ -48,4 +44,5 @@ gr.Gallery(columns=5,
48
  show_download_button=False,
49
  show_share_button=False)
50
 
51
- iface.launch(inbrowser=True)
 
 
14
 
15
 
16
  def stream_dataset_from_hub(split):
17
+ dataset = load_dataset_builder('mcarthuradal/arm-unicef')
18
+ data = dataset.as_streaming_dataset(split).iter(200)
19
+ yield next(data)
 
 
20
 
21
 
22
+ stream = stream_dataset_from_hub('train')
23
 
24
 
25
+ def get_images(split: str):
26
+
 
 
27
  n = 50
28
+ batch = stream['image'][:n]
29
 
30
+ return batch
31
 
32
 
33
  iface = gr.Interface(fn=get_images,
 
44
  show_download_button=False,
45
  show_share_button=False)
46
 
47
+ iface.launch(debug=True)
48
+