Spaces:
Paused
Paused
Adding GATED_IMAGENET token for authentication
Browse files12311 unmodified lines1516171819209 unmodified lines30313233343536import gradio as grimport randomimport time11 unmodified linesNUM_EXAMPLES = 1281167# Arbitrary small number, only using in devv'ing (uncomment #.take(DEV_AMOUNT) below to use it).DEV_AMOUNT = 100def main(percentage=10):9 unmodified lines# Load the dataset from the HF hub. Use streaming so as not to load the entire dataset at once.# Use the .take(DEV_AMOUNT) to only grab a small chunk of instances to develop with.dataset = load_dataset("ILSVRC/imagenet-1k", split="train", streaming=True,trust_remote_code=True).take(DEV_AMOUNT)# Create a set of indices that are randomly chosen, to change their labels.# Specifically, randomly choose NUM_EXAMPLES/percentage indices.123411 unmodified lines161718192021229 unmodified lines32333435363738import osimport gradio as grimport randomimport time11 unmodified linesNUM_EXAMPLES = 1281167# Arbitrary small number, only using in devv'ing (uncomment #.take(DEV_AMOUNT) below to use it).DEV_AMOUNT = 100GATED_IMAGENET = os.environ.get("GATED_IMAGENET")def main(percentage=10):9 unmodified lines# Load the dataset from the HF hub. Use streaming so as not to load the entire dataset at once.# Use the .take(DEV_AMOUNT) to only grab a small chunk of instances to develop with.dataset = load_dataset("ILSVRC/imagenet-1k", split="train", streaming=True,trust_remote_code=True, token=GATED_IMAGENET).take(DEV_AMOUNT)# Create a set of indices that are randomly chosen, to change their labels.# Specifically, randomly choose NUM_EXAMPLES/percentage indices.
app.py+3-1