DumbledoreWiz commited on
Commit
674ef1d
·
verified ·
1 Parent(s): 874cf66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,16 +1,18 @@
1
  import torch
2
- from transformers import ViTForImageClassification, ViTFeatureExtractor
3
  import gradio as gr
4
  from PIL import Image
5
 
6
  # Define the class labels as used during training
7
  labels = ['Leggings', 'Jogger', 'Palazzo', 'Cargo', 'Dresspants', 'Chinos']
8
 
9
- # Load the ViT model and feature extractor
10
- #model = ViTForImageClassification.from_pretrained("DumbledoreWiz/PantsShape")
11
- #feature_extractor = ViTFeatureExtractor.from_pretrained("google/vit-base-patch16-224-in21k")
 
12
  model = ViTForImageClassification.from_pretrained("DumbledoreWiz/PantsShape", config=config)
13
  feature_extractor = ViTFeatureExtractor.from_pretrained("DumbledoreWiz/PantsShape")
 
14
  # Set the model to evaluation mode
15
  model.eval()
16
 
 
1
  import torch
2
+ from transformers import ViTForImageClassification, ViTFeatureExtractor, ViTConfig
3
  import gradio as gr
4
  from PIL import Image
5
 
6
  # Define the class labels as used during training
7
  labels = ['Leggings', 'Jogger', 'Palazzo', 'Cargo', 'Dresspants', 'Chinos']
8
 
9
+ # Load the configuration
10
+ config = ViTConfig.from_pretrained("DumbledoreWiz/PantsShape")
11
+
12
+ # Load the ViT model with the configuration
13
  model = ViTForImageClassification.from_pretrained("DumbledoreWiz/PantsShape", config=config)
14
  feature_extractor = ViTFeatureExtractor.from_pretrained("DumbledoreWiz/PantsShape")
15
+
16
  # Set the model to evaluation mode
17
  model.eval()
18