prithivMLmods commited on
Commit
66eea3e
·
verified ·
1 Parent(s): 06ee5b6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +99 -1
README.md CHANGED
@@ -3,6 +3,9 @@ license: apache-2.0
3
  datasets:
4
  - yunusserhat/TurkishFoods-25
5
  ---
 
 
 
6
 
7
  ```py
8
  Classification Report:
@@ -37,4 +40,99 @@ hunkar_begendi 0.9583 0.9274 0.9426 248
37
  accuracy 0.9186 9168
38
  macro avg 0.9234 0.9216 0.9220 9168
39
  weighted avg 0.9194 0.9186 0.9186 9168
40
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  datasets:
4
  - yunusserhat/TurkishFoods-25
5
  ---
6
+ # TurkishFoods-25
7
+
8
+ > **TurkishFoods-25** is a computer vision model fine-tuned from `google/siglip2-base-patch16-224` for multi-class food image classification. It is trained to identify 25 traditional Turkish dishes using the `SiglipForImageClassification` architecture.
9
 
10
  ```py
11
  Classification Report:
 
40
  accuracy 0.9186 9168
41
  macro avg 0.9234 0.9216 0.9220 9168
42
  weighted avg 0.9194 0.9186 0.9186 9168
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Label Space: 25 Classes
48
+
49
+ The model classifies food images into the following Turkish dishes:
50
+
51
+ ```json
52
+ "id2label": {
53
+ "0": "asure",
54
+ "1": "baklava",
55
+ "2": "biber_dolmasi",
56
+ "3": "borek",
57
+ "4": "cig_kofte",
58
+ "5": "enginar",
59
+ "6": "et_sote",
60
+ "7": "gozleme",
61
+ "8": "hamsi",
62
+ "9": "hunkar_begendi",
63
+ "10": "icli_kofte",
64
+ "11": "ispanak",
65
+ "12": "izmir_kofte",
66
+ "13": "karniyarik",
67
+ "14": "kebap",
68
+ "15": "kisir",
69
+ "16": "kuru_fasulye",
70
+ "17": "lahmacun",
71
+ "18": "lokum",
72
+ "19": "manti",
73
+ "20": "mucver",
74
+ "21": "pirinc_pilavi",
75
+ "22": "simit",
76
+ "23": "taze_fasulye",
77
+ "24": "yaprak_sarma"
78
+ }
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Install Requirements
84
+
85
+ ```bash
86
+ pip install -q transformers torch pillow gradio
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Inference Script
92
+
93
+ ```python
94
+ import gradio as gr
95
+ from transformers import AutoImageProcessor, SiglipForImageClassification
96
+ from PIL import Image
97
+ import torch
98
+
99
+ model_name = "prithivMLmods/TurkishFoods-25" # Replace with your Hugging Face repo
100
+ model = SiglipForImageClassification.from_pretrained(model_name)
101
+ processor = AutoImageProcessor.from_pretrained(model_name)
102
+
103
+ id2label = {
104
+ "0": "asure", "1": "baklava", "2": "biber_dolmasi", "3": "borek", "4": "cig_kofte",
105
+ "5": "enginar", "6": "et_sote", "7": "gozleme", "8": "hamsi", "9": "hunkar_begendi",
106
+ "10": "icli_kofte", "11": "ispanak", "12": "izmir_kofte", "13": "karniyarik", "14": "kebap",
107
+ "15": "kisir", "16": "kuru_fasulye", "17": "lahmacun", "18": "lokum", "19": "manti",
108
+ "20": "mucver", "21": "pirinc_pilavi", "22": "simit", "23": "taze_fasulye", "24": "yaprak_sarma"
109
+ }
110
+
111
+ def predict_food(image):
112
+ image = Image.fromarray(image).convert("RGB")
113
+ inputs = processor(images=image, return_tensors="pt")
114
+ with torch.no_grad():
115
+ logits = model(**inputs).logits
116
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
117
+ return {id2label[str(i)]: round(probs[i], 3) for i in range(len(probs))}
118
+
119
+ iface = gr.Interface(
120
+ fn=predict_food,
121
+ inputs=gr.Image(type="numpy"),
122
+ outputs=gr.Label(num_top_classes=5, label="Top Turkish Foods"),
123
+ title="TurkishFoods-25 Classifier",
124
+ description="Upload a food image to identify one of 25 Turkish dishes."
125
+ )
126
+
127
+ if __name__ == "__main__":
128
+ iface.launch()
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Applications
134
+
135
+ * Turkish cuisine image datasets
136
+ * Food delivery or smart restaurant apps
137
+ * Culinary learning platforms
138
+ * Nutrition tracking via image-based recognition