Isabel Gwara commited on
Commit
9f0de8c
·
1 Parent(s): 9f72823

add support for categories.txt

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -13,11 +13,22 @@ import h5py # remove later
13
  ### model loading ###
14
  ### -------------------------------- ###
15
 
16
- model = load_model('model.h5') # single file model
17
- labels = ['cheetah', 'hyena', 'jaguar', 'tiger'] # will need to be loaded from file in the order of your directories
18
 
19
- ## -------------------------------- ###
20
- ### file reading ###
 
 
 
 
 
 
 
 
 
 
 
21
  ### -------------------------------- ###
22
  # placeholders in case info.txt does not exist
23
  placeholder = "please create an info.txt to customize this text"
 
13
  ### model loading ###
14
  ### -------------------------------- ###
15
 
16
+ model = load_model('model.h5') # single file model from colab
17
+ labels = ['please upload categories.txt' for i in range(100)] # placeholder
18
 
19
+
20
+ ## --------------------------------- ###
21
+ ### reading: categories.txt ###
22
+ ### -------------------------------- ###
23
+ if os.path.isfile("categories.txt"):
24
+ # open info.txt in read mode
25
+ categories = open("categories.txt", "r")
26
+ labels = categories.readline().split()
27
+ print(labels)
28
+
29
+
30
+ ## --------------------------------- ###
31
+ ### reading: info.txt ###
32
  ### -------------------------------- ###
33
  # placeholders in case info.txt does not exist
34
  placeholder = "please create an info.txt to customize this text"