0-ma commited on
Commit
76f81a0
1 Parent(s): 8b6ea62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -18
app.py CHANGED
@@ -3,6 +3,7 @@ import numpy as np
3
  from PIL import Image
4
  from transformers import AutoImageProcessor, AutoModelForImageClassification
5
  import os
 
6
  model_names = [
7
  "0-ma/swin-geometric-shapes-tiny",
8
  "0-ma/mobilenet-v2-geometric-shapes",
@@ -14,24 +15,6 @@ model_names = [
14
  "0-ma/resnet-geometric-shapes",
15
  "0-ma/vit-geometric-shapes-tiny",
16
  ]
17
-
18
- # example_images = [
19
- # 'example/1_None.jpg',
20
- # 'example/2_Circle.jpg',
21
- # 'example/3_Triangle.jpg',
22
- # 'example/4_Square.jpg',
23
- # 'example/5_Pentagone.jpg',
24
- # 'example/6_Hexagone.jpg'
25
- # ]
26
-
27
- example_dir = "./example"
28
- example_images = []
29
- for example_image in os.list_dir(example_dir):
30
- example_images+= [os.path.join(example_dir,example_image)]
31
-
32
- example_images = [os.path.join(example_dir,example_image) for example_image in os.listdir(example_dir)]
33
-
34
- #labels = [example.split("_")[1].split(".")[0] for example in example_images]
35
  labels = [
36
  'None',
37
  'Circle',
@@ -40,6 +23,8 @@ labels = [
40
  'Pentagone',
41
  'Hexagone'
42
  ]
 
 
43
 
44
  feature_extractors = {model_name: AutoImageProcessor.from_pretrained(model_name) for model_name in model_names}
45
  classification_models = {model_name: AutoModelForImageClassification.from_pretrained(model_name) for model_name in model_names}
 
3
  from PIL import Image
4
  from transformers import AutoImageProcessor, AutoModelForImageClassification
5
  import os
6
+
7
  model_names = [
8
  "0-ma/swin-geometric-shapes-tiny",
9
  "0-ma/mobilenet-v2-geometric-shapes",
 
15
  "0-ma/resnet-geometric-shapes",
16
  "0-ma/vit-geometric-shapes-tiny",
17
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  labels = [
19
  'None',
20
  'Circle',
 
23
  'Pentagone',
24
  'Hexagone'
25
  ]
26
+ example_dir = "./example"
27
+ example_images = [os.path.join(example_dir,example_image) for example_image in os.listdir(example_dir)]
28
 
29
  feature_extractors = {model_name: AutoImageProcessor.from_pretrained(model_name) for model_name in model_names}
30
  classification_models = {model_name: AutoModelForImageClassification.from_pretrained(model_name) for model_name in model_names}