Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 10 |
-
|
| 11 |
-
|
|
|
|
| 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 |
|