fischjos commited on
Commit
6a8bed6
1 Parent(s): 27ecaa2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -10,14 +10,18 @@ from tensorflow.keras.models import Model
10
  from tensorflow.keras.optimizers import Adam
11
 
12
  # Function to download and extract the dataset
13
- def download_and_extract_dataset(dataset_name):
14
- # Make sure the kaggle.json file is in the proper location
15
  os.environ['KAGGLE_CONFIG_DIR'] = os.path.expanduser("~/.kaggle/")
 
16
  # Download the dataset
17
- os.system(f'kaggle datasets download -d mikoajkolman/pokemon-images-first-generation17000-files')
 
 
 
18
  # Extract the dataset
19
- with zipfile.ZipFile(f'{dataset_name}.zip', 'r') as zip_ref:
20
- zip_ref.extractall('.')
21
 
22
  # Function to find the greatest batch size that fully divides the total samples
23
  def find_batch_size(total_samples, initial_batch_size):
@@ -32,8 +36,7 @@ tf.get_logger().setLevel('ERROR')
32
  tf.autograph.set_verbosity(2)
33
 
34
  # Download and extract the dataset
35
- dataset_name = 'mikoajkolman/pokemon-images-first
36
-
37
 
38
  # Define the Pokémon classes to be classified
39
  classes = ['Doduo', 'Geodude', 'Zubat']
 
10
  from tensorflow.keras.optimizers import Adam
11
 
12
  # Function to download and extract the dataset
13
+ def download_and_extract_dataset():
14
+ # Set the Kaggle configuration directory
15
  os.environ['KAGGLE_CONFIG_DIR'] = os.path.expanduser("~/.kaggle/")
16
+
17
  # Download the dataset
18
+ dataset_zip = 'pokemon-images-first-generation17000-files.zip'
19
+ kaggle_dataset = 'mikoajkolman/pokemon-images-first-generation17000-files'
20
+ os.system(f'kaggle datasets download -d {kaggle_dataset}')
21
+
22
  # Extract the dataset
23
+ with zipfile.ZipFile(dataset_zip, 'r') as zip_ref:
24
+ zip_ref.extractall('pokemon_dataset')
25
 
26
  # Function to find the greatest batch size that fully divides the total samples
27
  def find_batch_size(total_samples, initial_batch_size):
 
36
  tf.autograph.set_verbosity(2)
37
 
38
  # Download and extract the dataset
39
+ download_and_extract_dataset()
 
40
 
41
  # Define the Pokémon classes to be classified
42
  classes = ['Doduo', 'Geodude', 'Zubat']