lukelike1001 commited on
Commit
a23f77c
1 Parent(s): 08fc93d

changed pil image to filepath

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -4,7 +4,7 @@ import tensorflow as tf
4
  from tensorflow import keras
5
 
6
  # load the pre-trained model from the appropriate file path
7
- def predict_plant(image):
8
  model = tf.keras.models.load_model('lukelike1001/my_model')
9
 
10
  # redefine values from the model
@@ -14,11 +14,10 @@ def predict_plant(image):
14
  'jack_in_the_pulpit', 'poison_sumac',
15
  'virginia_creeper', 'western_poison_ivy',
16
  'western_poison_oak']
17
- path = image
18
 
19
  # load the image into a variable
20
  img = tf.keras.utils.load_img(
21
- path, target_size=(img_height, img_width)
22
  )
23
 
24
  # convert the image into a tensor and create a batch for testing
@@ -42,13 +41,14 @@ def predict_plant(image):
42
  )
43
  return "\n".join(output)
44
 
45
- # give the model a name
46
- title = "Leaftracker Demonstration"
 
47
 
48
  # launch the app
49
  app = gr.Interface(
50
  fn=predict_plant,
51
- inputs=gr.Image(type="pil"),
52
  outputs="text",
53
  flagging_options=["incorrect", "other"],
54
  )
 
4
  from tensorflow import keras
5
 
6
  # load the pre-trained model from the appropriate file path
7
+ def predict_plant(input_image):
8
  model = tf.keras.models.load_model('lukelike1001/my_model')
9
 
10
  # redefine values from the model
 
14
  'jack_in_the_pulpit', 'poison_sumac',
15
  'virginia_creeper', 'western_poison_ivy',
16
  'western_poison_oak']
 
17
 
18
  # load the image into a variable
19
  img = tf.keras.utils.load_img(
20
+ input_image, target_size=(img_height, img_width)
21
  )
22
 
23
  # convert the image into a tensor and create a batch for testing
 
41
  )
42
  return "\n".join(output)
43
 
44
+ # describe the model
45
+ title = "Leaftracker Interactive Model"
46
+ description = "Image Classification Model For Identifying Toxic Plants from their Non-Toxic Look-Alikes"
47
 
48
  # launch the app
49
  app = gr.Interface(
50
  fn=predict_plant,
51
+ inputs=gr.Image(type="filepath"),
52
  outputs="text",
53
  flagging_options=["incorrect", "other"],
54
  )