DumbledoreWiz commited on
Commit
4e3ba00
·
verified ·
1 Parent(s): 0d3f848

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import torch
2
- from transformers import ViTForImageClassification, ViTFeatureExtractor, ViTConfig
3
  import gradio as gr
4
  from PIL import Image
5
  import os
@@ -8,7 +8,7 @@ import logging
8
  # Set up logging
9
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
10
 
11
- # Define the class labels as used during training
12
  labels = ['Leggings', 'Jogger', 'Palazzo', 'Cargo', 'Dresspants', 'Chinos']
13
  logging.info(f"Labels: {labels}")
14
 
@@ -52,9 +52,6 @@ logging.info("Model set to evaluation mode")
52
  feature_extractor = ViTFeatureExtractor.from_pretrained("google/vit-base-patch16-224-in21k")
53
  logging.info("Feature extractor loaded")
54
 
55
-
56
- logging.info("Model and feature extractor loaded successfully")
57
-
58
  # Define the prediction function
59
  def predict(image):
60
  logging.info("Starting prediction")
 
1
  import torch
2
+ from transformers import ViTForImageClassification, ViTFeatureExtractor
3
  import gradio as gr
4
  from PIL import Image
5
  import os
 
8
  # Set up logging
9
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
10
 
11
+ # Define the class labels in the correct order as used during training
12
  labels = ['Leggings', 'Jogger', 'Palazzo', 'Cargo', 'Dresspants', 'Chinos']
13
  logging.info(f"Labels: {labels}")
14
 
 
52
  feature_extractor = ViTFeatureExtractor.from_pretrained("google/vit-base-patch16-224-in21k")
53
  logging.info("Feature extractor loaded")
54
 
 
 
 
55
  # Define the prediction function
56
  def predict(image):
57
  logging.info("Starting prediction")