Spaces:
Sleeping
Sleeping
Upload config.py
Browse files
config.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Configuration file for FoodViT project
|
| 3 |
+
Contains all model and application settings
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import os
|
| 7 |
+
import torch
|
| 8 |
+
|
| 9 |
+
# Model Configuration
|
| 10 |
+
MODEL_CONFIG = {
|
| 11 |
+
"feature_extractor_name": "google/vit-base-patch16-224",
|
| 12 |
+
"num_labels": 3,
|
| 13 |
+
"image_size": 224,
|
| 14 |
+
"device": "cuda" if torch.cuda.is_available() else "cpu"
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
# Class Configuration
|
| 18 |
+
CLASS_CONFIG = {
|
| 19 |
+
"class_names": ["pizza", "steak", "sushi"],
|
| 20 |
+
"id2label": {0: "pizza", 1: "steak", 2: "sushi"},
|
| 21 |
+
"label2id": {"pizza": 0, "steak": 1, "sushi": 2}
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
# Image Processing Configuration
|
| 25 |
+
IMAGE_CONFIG = {
|
| 26 |
+
"target_size": (224, 224),
|
| 27 |
+
"normalize_mean": [0.5, 0.5, 0.5],
|
| 28 |
+
"normalize_std": [0.5, 0.5, 0.5]
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
# Gradio Interface Configuration
|
| 32 |
+
GRADIO_CONFIG = {
|
| 33 |
+
"title": "FoodViT - Food Classification",
|
| 34 |
+
"description": "Upload an image to classify it as pizza, steak, or sushi",
|
| 35 |
+
# Examples are now loaded dynamically from assets/samples/
|
| 36 |
+
"theme": "default"
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
# Application Configuration
|
| 40 |
+
APP_CONFIG = {
|
| 41 |
+
"debug": False,
|
| 42 |
+
"host": "127.0.0.1",
|
| 43 |
+
"port": 7860,
|
| 44 |
+
"share": False
|
| 45 |
+
}
|