Update app.py
Browse files
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 =
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
streaming=True)
|
| 21 |
-
return dataset
|
| 22 |
|
| 23 |
|
| 24 |
-
|
| 25 |
|
| 26 |
|
| 27 |
-
def get_images(
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
# image_names = [filename for filename in filenames if filename.endswith('.tif')]
|
| 31 |
n = 50
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 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(
|
|
|
|
|
|
| 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 |
+
|