andrewsunanda commited on
Commit
e264be8
·
1 Parent(s): 727d4bd

Upload 2 files

Browse files
Files changed (2) hide show
  1. eda.py +6 -15
  2. prediction.py +6 -16
eda.py CHANGED
@@ -27,24 +27,15 @@ def run():
27
 
28
 
29
  st.markdown('---')
30
-
31
- # Define the path to the dataset
32
 
33
- # Load the dataset from Hugging Face
34
- from datasets import load_dataset
35
- dataset = load_dataset("andrewsunanda/fast_food_image_classification")
36
-
37
- # Define the batch size and image size
38
  batch_size = 256
39
  img_size = (64, 64)
40
-
41
- # Define the paths to the train, validation, and test folders
42
- dataset_path = "andrewsunanda/fast_food_image_classification"
43
- train_path = os.path.join(dataset_path, 'Train')
44
- valid_path = os.path.join(dataset_path, 'Valid')
45
- test_path = os.path.join(dataset_path, 'Test')
46
-
47
-
48
  # Create data generators for training, validation, and testing
49
  train_datagen = ImageDataGenerator(
50
  rescale=1./255,
 
27
 
28
 
29
  st.markdown('---')
30
+ main_path= 'D:\\tugas_andrew_DS\\phase_2\\m2\\food'
 
31
 
32
+ # Define batch size and image size
 
 
 
 
33
  batch_size = 256
34
  img_size = (64, 64)
35
+ # Define paths to the data folders
36
+ train_path = os.path.join(main_path, 'Train')
37
+ valid_path = os.path.join(main_path, 'Valid')
38
+ test_path = os.path.join(main_path, 'Test')
 
 
 
 
39
  # Create data generators for training, validation, and testing
40
  train_datagen = ImageDataGenerator(
41
  rescale=1./255,
prediction.py CHANGED
@@ -20,25 +20,15 @@ def preprocess_input_image(img_path):
20
  x /= 255.
21
  return x, img1
22
 
23
- import os
24
- import torch
25
- import torchvision.transforms as transforms
26
- from torch.utils.data import DataLoader
27
- from datasets import load_dataset
28
-
29
- # Load the dataset from Hugging Face
30
- from datasets import load_dataset
31
- dataset = load_dataset("andrewsunanda/fast_food_image_classification")
32
 
33
- # Define the batch size and image size
34
  batch_size = 256
35
  img_size = (64, 64)
36
-
37
- # Define the paths to the train, validation, and test folders
38
- dataset_path = "andrewsunanda/fast_food_image_classification"
39
- train_path = os.path.join(dataset_path, 'Train')
40
- valid_path = os.path.join(dataset_path, 'Valid')
41
- test_path = os.path.join(dataset_path, 'Test')
42
 
43
  # Create data generators for training, validation, and testing
44
  train_datagen = ImageDataGenerator(
 
20
  x /= 255.
21
  return x, img1
22
 
23
+ main_path= 'D:\\tugas_andrew_DS\\phase_2\\m2\\food'
 
 
 
 
 
 
 
 
24
 
25
+ # Define batch size and image size
26
  batch_size = 256
27
  img_size = (64, 64)
28
+ # Define paths to the data folders
29
+ train_path = os.path.join(main_path, 'Train')
30
+ valid_path = os.path.join(main_path, 'Valid')
31
+ test_path = os.path.join(main_path, 'Test')
 
 
32
 
33
  # Create data generators for training, validation, and testing
34
  train_datagen = ImageDataGenerator(