yusyel commited on
Commit
df85698
1 Parent(s): 25c2cee
app.py CHANGED
@@ -7,21 +7,21 @@ import numpy as np
7
 
8
  model = from_pretrained_keras("yusyel/clothing")
9
 
10
- class_names=["dress.jpg",
11
- "hat.jpg",
12
- "longsleee.jpg",
13
- "outwear.pg",
14
- "pants.jpg",
15
- "shirt.jpg",
16
- "shoes.jpg",
17
- "shorts.jpg",
18
- "skirt.jpg",
19
- "t-shirt.jpg"]
20
 
21
 
22
 
23
  def preprocess_image(img):
24
- img = load_img(img, target_size=(249, 249, 3))
25
  img = image.img_to_array(img)
26
  img = np.expand_dims(img, axis=0)
27
  img /= 255.0
@@ -33,7 +33,8 @@ def preprocess_image(img):
33
  def predict(img):
34
  img = preprocess_image(img)
35
  pred = model.predict(img)
36
- pred = np.squeeze(pred).astype(float)
 
37
  print(pred)
38
  return dict(zip(class_names, pred))
39
 
@@ -50,7 +51,7 @@ demo = gr.Interface(
50
  ["./img/pants.jpg"],
51
  ["./img/shirt.jpg"],
52
  ["./img/shoes.jpg"],
53
- ["./img/shorts.jpg"],
54
  ["./img/skirt.jpg"],
55
  ["./img/t-shirt.jpg"],
56
  ],
 
7
 
8
  model = from_pretrained_keras("yusyel/clothing")
9
 
10
+ class_names=["dress",
11
+ "hat",
12
+ "longsleee",
13
+ "outwear",
14
+ "pants",
15
+ "shirt",
16
+ "shoes",
17
+ "shorts",
18
+ "skirt",
19
+ "t-shirt"]
20
 
21
 
22
 
23
  def preprocess_image(img):
24
+ img = load_img(img, target_size=(299, 299, 3))
25
  img = image.img_to_array(img)
26
  img = np.expand_dims(img, axis=0)
27
  img /= 255.0
 
33
  def predict(img):
34
  img = preprocess_image(img)
35
  pred = model.predict(img)
36
+ print(pred)
37
+ pred = np.round(np.squeeze(pred).astype(float),5)
38
  print(pred)
39
  return dict(zip(class_names, pred))
40
 
 
51
  ["./img/pants.jpg"],
52
  ["./img/shirt.jpg"],
53
  ["./img/shoes.jpg"],
54
+ ["./img/short.jpg"],
55
  ["./img/skirt.jpg"],
56
  ["./img/t-shirt.jpg"],
57
  ],
flagged/img/0ce3b8e7aa4df42ff211fc38c49a73e486b3accf/tmpva0ptb1u.jpg ADDED
flagged/img/302233888fff6cbb20dc571a2aa2f4ca4582a82c/tmp10zz4cfv.jpg ADDED
flagged/img/c55bbd60f3f87a4a3ae82b289045d0f9471ea3b4/tmp94igg62a.jpg ADDED
flagged/img/edf8db2e47ee5fb67942da896db080edef19574e/tmp1qgn1e9n.jpg ADDED
flagged/log.csv ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ img,output,flag,username,timestamp
2
+ /home/yusuf/okul/clothing/flagged/img/edf8db2e47ee5fb67942da896db080edef19574e/tmp1qgn1e9n.jpg,/home/yusuf/okul/clothing/flagged/output/tmpoz3eynnc.json,,,2023-08-22 19:05:19.413148
3
+ /home/yusuf/okul/clothing/flagged/img/302233888fff6cbb20dc571a2aa2f4ca4582a82c/tmp10zz4cfv.jpg,/home/yusuf/okul/clothing/flagged/output/tmpy4wj9m6r.json,,,2023-08-22 19:46:06.542922
4
+ /home/yusuf/okul/clothing/flagged/img/0ce3b8e7aa4df42ff211fc38c49a73e486b3accf/tmpva0ptb1u.jpg,/home/yusuf/okul/clothing/flagged/output/tmpdi2ceh8q.json,,,2023-08-22 19:46:07.960612
5
+ /home/yusuf/okul/clothing/flagged/img/c55bbd60f3f87a4a3ae82b289045d0f9471ea3b4/tmp94igg62a.jpg,/home/yusuf/okul/clothing/flagged/output/tmplsiza_8_.json,,,2023-08-22 19:46:13.040043
flagged/output/tmpdi2ceh8q.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"label": "t-shirt", "confidences": [{"label": "t-shirt", "confidence": 6.181421756744385}, {"label": "longsleee", "confidence": 3.4848127365112305}, {"label": "dress", "confidence": 2.3854408264160156}, {"label": "shirt", "confidence": -1.1809395551681519}, {"label": "shorts", "confidence": -2.108891248703003}, {"label": "shoes", "confidence": -3.061194658279419}, {"label": "hat", "confidence": -3.9095823764801025}, {"label": "outwear", "confidence": -4.6832733154296875}, {"label": "pants", "confidence": -5.055410861968994}, {"label": "skirt", "confidence": -5.316753387451172}]}
flagged/output/tmplsiza_8_.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"label": "t-shirt", "confidences": [{"label": "t-shirt", "confidence": 6.181421756744385}, {"label": "longsleee", "confidence": 3.4848127365112305}, {"label": "dress", "confidence": 2.3854408264160156}, {"label": "shirt", "confidence": -1.1809395551681519}, {"label": "shorts", "confidence": -2.108891248703003}, {"label": "shoes", "confidence": -3.061194658279419}, {"label": "hat", "confidence": -3.9095823764801025}, {"label": "outwear", "confidence": -4.6832733154296875}, {"label": "pants", "confidence": -5.055410861968994}, {"label": "skirt", "confidence": -5.316753387451172}]}
flagged/output/tmpoz3eynnc.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"label": "t-shirt", "confidences": [{"label": "t-shirt", "confidence": 6.181421756744385}, {"label": "longsleee", "confidence": 3.4848124980926514}, {"label": "dress", "confidence": 2.385441303253174}, {"label": "shirt", "confidence": -1.1809393167495728}, {"label": "shorts", "confidence": -2.108891487121582}, {"label": "shoes", "confidence": -3.0611960887908936}, {"label": "hat", "confidence": -3.9095826148986816}, {"label": "outwear", "confidence": -4.683272838592529}, {"label": "pants", "confidence": -5.055410385131836}, {"label": "skirt", "confidence": -5.316753387451172}]}
flagged/output/tmpy4wj9m6r.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"label": "t-shirt", "confidences": [{"label": "t-shirt", "confidence": 6.181421756744385}, {"label": "longsleee", "confidence": 3.4848127365112305}, {"label": "dress", "confidence": 2.3854408264160156}, {"label": "shirt", "confidence": -1.1809395551681519}, {"label": "shorts", "confidence": -2.108891248703003}, {"label": "shoes", "confidence": -3.061194658279419}, {"label": "hat", "confidence": -3.9095823764801025}, {"label": "outwear", "confidence": -4.6832733154296875}, {"label": "pants", "confidence": -5.055410861968994}, {"label": "skirt", "confidence": -5.316753387451172}]}
img/dress.jpg CHANGED
img/hat.jpg CHANGED
img/longsleeve.jpg CHANGED
img/outwear.jpg CHANGED
img/pants.jpg CHANGED
img/shirt.jpg CHANGED
img/shoes.jpg CHANGED
img/short.jpg ADDED
img/shorts.jpg DELETED
img/skirt.jpg CHANGED
img/t-shirt.jpg CHANGED
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
  gradio==3.39.0
2
  numpy==1.23.3
3
- tensorflow==2.9.1
 
1
  gradio==3.39.0
2
  numpy==1.23.3
3
+ #tensorflow==2.9.1