Spaces:
Sleeping
Sleeping
Adding GATED_IMAGENET token for authentication
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import random
|
| 3 |
import time
|
|
@@ -15,6 +16,7 @@ https://huggingface.co/datasets/datacomp
|
|
| 15 |
NUM_EXAMPLES = 1281167
|
| 16 |
# Arbitrary small number, only using in devv'ing (uncomment #.take(DEV_AMOUNT) below to use it).
|
| 17 |
DEV_AMOUNT = 100
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
def main(percentage=10):
|
|
@@ -30,7 +32,7 @@ def main(percentage=10):
|
|
| 30 |
# Load the dataset from the HF hub. Use streaming so as not to load the entire dataset at once.
|
| 31 |
# Use the .take(DEV_AMOUNT) to only grab a small chunk of instances to develop with.
|
| 32 |
dataset = load_dataset("ILSVRC/imagenet-1k", split="train", streaming=True,
|
| 33 |
-
trust_remote_code=True).take(DEV_AMOUNT)
|
| 34 |
|
| 35 |
# Create a set of indices that are randomly chosen, to change their labels.
|
| 36 |
# Specifically, randomly choose NUM_EXAMPLES/percentage indices.
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
| 3 |
import random
|
| 4 |
import time
|
|
|
|
| 16 |
NUM_EXAMPLES = 1281167
|
| 17 |
# Arbitrary small number, only using in devv'ing (uncomment #.take(DEV_AMOUNT) below to use it).
|
| 18 |
DEV_AMOUNT = 100
|
| 19 |
+
GATED_IMAGENET = os.environ.get("GATED_IMAGENET")
|
| 20 |
|
| 21 |
|
| 22 |
def main(percentage=10):
|
|
|
|
| 32 |
# Load the dataset from the HF hub. Use streaming so as not to load the entire dataset at once.
|
| 33 |
# Use the .take(DEV_AMOUNT) to only grab a small chunk of instances to develop with.
|
| 34 |
dataset = load_dataset("ILSVRC/imagenet-1k", split="train", streaming=True,
|
| 35 |
+
trust_remote_code=True, token=GATED_IMAGENET).take(DEV_AMOUNT)
|
| 36 |
|
| 37 |
# Create a set of indices that are randomly chosen, to change their labels.
|
| 38 |
# Specifically, randomly choose NUM_EXAMPLES/percentage indices.
|