Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,8 @@ import gradio as gr
|
|
3 |
import random
|
4 |
import time
|
5 |
from datasets import load_dataset, Dataset
|
6 |
-
|
|
|
7 |
"""
|
8 |
This code is designed to read in the ImageNet 1K ILSVRC dataset from the Hugging Face Hub,
|
9 |
then create a new version of this dataset with {percentage} lines with random labels between 0-9,
|
@@ -32,7 +33,7 @@ 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
|
36 |
|
37 |
# Create a set of indices that are randomly chosen, to change their labels.
|
38 |
# Specifically, randomly choose NUM_EXAMPLES/percentage indices.
|
|
|
3 |
import random
|
4 |
import time
|
5 |
from datasets import load_dataset, Dataset
|
6 |
+
from PIL import PngImagePlugin
|
7 |
+
PngImagePlugin.MAX_TEXT_CHUNK = 1048576 * 10 # this is the current value
|
8 |
"""
|
9 |
This code is designed to read in the ImageNet 1K ILSVRC dataset from the Hugging Face Hub,
|
10 |
then create a new version of this dataset with {percentage} lines with random labels between 0-9,
|
|
|
33 |
# Load the dataset from the HF hub. Use streaming so as not to load the entire dataset at once.
|
34 |
# Use the .take(DEV_AMOUNT) to only grab a small chunk of instances to develop with.
|
35 |
dataset = load_dataset("ILSVRC/imagenet-1k", split="train", streaming=True,
|
36 |
+
trust_remote_code=True, token=GATED_IMAGENET).take(DEV_AMOUNT)
|
37 |
|
38 |
# Create a set of indices that are randomly chosen, to change their labels.
|
39 |
# Specifically, randomly choose NUM_EXAMPLES/percentage indices.
|