rocioadlc commited on
Commit
d14ae0d
1 Parent(s): 5b50417

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -55,13 +55,13 @@ class_labels = ['cardboard', 'glass', 'metal', 'paper', 'plastic', 'trash']
55
  # Function to predict image label and score
56
  def predict_image(input):
57
  # Resize the image to the size expected by the model and convert to numpy array
58
- image_array = tf.keras.preprocessing.image.img_to_array(input.resize((224, 244)))
59
  # Normalize the image
60
  image_array = tf.keras.applications.efficientnet.preprocess_input(image_array)
61
  # Expand the dimensions to create a batch
62
  image_array = tf.expand_dims(image_array, 0)
63
  # Predict using the model
64
- predictions = model_tl.predict(image_array)
65
  class_labels = ['cardboard', 'glass', 'metal', 'paper', 'plastic', 'trash']
66
  category_scores = {}
67
  for i, class_label in enumerate(class_labels):
@@ -70,7 +70,6 @@ def predict_image(input):
70
  return category_scores
71
 
72
 
73
-
74
  loader = WebBaseLoader(["https://www.epa.gov/recycle/frequent-questions-recycling", "https://www.whitehorsedc.gov.uk/vale-of-white-horse-district-council/recycling-rubbish-and-waste/lets-get-real-about-recycling/", "https://www.teimas.com/blog/13-preguntas-y-respuestas-sobre-la-ley-de-residuos-07-2022", "https://www.molok.com/es/blog/gestion-de-residuos-solidos-urbanos-rsu-10-dudas-comunes"])
75
  data=loader.load()
76
  # split documents
 
55
  # Function to predict image label and score
56
  def predict_image(input):
57
  # Resize the image to the size expected by the model and convert to numpy array
58
+ image_array = tf.keras.preprocessing.image.img_to_array(input.resize((244, 224))) # Cambiar el orden de las dimensiones
59
  # Normalize the image
60
  image_array = tf.keras.applications.efficientnet.preprocess_input(image_array)
61
  # Expand the dimensions to create a batch
62
  image_array = tf.expand_dims(image_array, 0)
63
  # Predict using the model
64
+ predictions = model1.predict(image_array)
65
  class_labels = ['cardboard', 'glass', 'metal', 'paper', 'plastic', 'trash']
66
  category_scores = {}
67
  for i, class_label in enumerate(class_labels):
 
70
  return category_scores
71
 
72
 
 
73
  loader = WebBaseLoader(["https://www.epa.gov/recycle/frequent-questions-recycling", "https://www.whitehorsedc.gov.uk/vale-of-white-horse-district-council/recycling-rubbish-and-waste/lets-get-real-about-recycling/", "https://www.teimas.com/blog/13-preguntas-y-respuestas-sobre-la-ley-de-residuos-07-2022", "https://www.molok.com/es/blog/gestion-de-residuos-solidos-urbanos-rsu-10-dudas-comunes"])
74
  data=loader.load()
75
  # split documents