Mlaana commited on
Commit
53d945d
·
1 Parent(s): 69b56ed
Files changed (2) hide show
  1. app.py +2 -3
  2. labels.json +28 -0
app.py CHANGED
@@ -11,8 +11,7 @@ class_labels = [
11
  'Nasi Putih','Nugget','Opor Ayam','Pempek',
12
  'Rendang','Roti','Sate','Sosis',
13
  'Soto','Tahu','Telur','Tempe',
14
- 'Tumis Kangkung',
15
- 'Udang',
16
  ]
17
 
18
  def process(img):
@@ -26,7 +25,7 @@ def predict(img):
26
  class_idx = np.argmax(pred)
27
  confidence = pred[0][class_idx]
28
  class_name = class_labels[class_idx]
29
- return f"{class_name} (confidence: {confidence:.2f})"
30
 
31
  interface = gr.Interface(fn=predict, inputs=gr.Image(type="pil"),outputs="text")
32
  interface.launch()
 
11
  'Nasi Putih','Nugget','Opor Ayam','Pempek',
12
  'Rendang','Roti','Sate','Sosis',
13
  'Soto','Tahu','Telur','Tempe',
14
+ 'Tumis Kangkung','Udang',
 
15
  ]
16
 
17
  def process(img):
 
25
  class_idx = np.argmax(pred)
26
  confidence = pred[0][class_idx]
27
  class_name = class_labels[class_idx]
28
+ return class_name
29
 
30
  interface = gr.Interface(fn=predict, inputs=gr.Image(type="pil"),outputs="text")
31
  interface.launch()
labels.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Ayam Bakar": {"Calories": 165, "Protein": 27, "Fat": 5, "Carbo": 0},
3
+ "Ayam Goreng": {"Calories": 260, "Protein": 25, "Fat": 17, "Carbo": 5},
4
+ "Bakso": {"Calories": 150, "Protein": 12, "Fat": 10, "Carbo": 5},
5
+ "Bakwan": {"Calories": 200, "Protein": 3, "Fat": 12, "Carbo": 20},
6
+ "Bihun": {"Calories": 110, "Protein": 1.5, "Fat": 0.5, "Carbo": 25},
7
+ "Capcay": {"Calories": 70, "Protein": 3, "Fat": 2, "Carbo": 10},
8
+ "Gado-Gado": {"Calories": 140, "Protein": 6, "Fat": 9, "Carbo": 10},
9
+ "Ikan Goreng": {"Calories": 200, "Protein": 22, "Fat": 12, "Carbo": 0},
10
+ "Kerupuk": {"Calories": 500, "Protein": 2, "Fat": 30, "Carbo": 55},
11
+ "Martabak Telur": {"Calories": 290, "Protein": 8, "Fat": 20, "Carbo": 20},
12
+ "Mie": {"Calories": 180, "Protein": 4, "Fat": 7, "Carbo": 25},
13
+ "Nasi Goreng": {"Calories": 180, "Protein": 4, "Fat": 6, "Carbo": 28},
14
+ "Nasi Putih": {"Calories": 130, "Protein": 2.5, "Fat": 0.3, "Carbo": 28},
15
+ "Nugget": {"Calories": 270, "Protein": 12, "Fat": 18, "Carbo": 15},
16
+ "Opor Ayam": {"Calories": 200, "Protein": 15, "Fat": 14, "Carbo": 3},
17
+ "Pempek": {"Calories": 150, "Protein": 7, "Fat": 7, "Carbo": 15},
18
+ "Rendang": {"Calories": 193, "Protein": 15, "Fat": 14, "Carbo": 3},
19
+ "Roti": {"Calories": 265, "Protein": 9, "Fat": 3.5, "Carbo": 49},
20
+ "Sate": {"Calories": 210, "Protein": 16, "Fat": 13, "Carbo": 5},
21
+ "Sosis": {"Calories": 310, "Protein": 12, "Fat": 28, "Carbo": 2},
22
+ "Soto": {"Calories": 100, "Protein": 6, "Fat": 5, "Carbo": 7},
23
+ "Tahu": {"Calories": 110, "Protein": 8, "Fat": 7, "Carbo": 3},
24
+ "Telur": {"Calories": 143, "Protein": 13, "Fat": 10, "Carbo": 1},
25
+ "Tempe": {"Calories": 192, "Protein": 19, "Fat": 11, "Carbo": 9},
26
+ "Tumis Kangkung": {"Calories": 60, "Protein": 2, "Fat": 3, "Carbo": 6},
27
+ "Udang": {"Calories": 99, "Protein": 24, "Fat": 0.3, "Carbo": 0.2}
28
+ }