Prathamesh1420 commited on
Commit
20ab3bc
·
verified ·
1 Parent(s): 0ace04f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -3,7 +3,7 @@ import os
3
  from PIL import Image
4
  import numpy as np
5
  import pickle
6
- import tensorflow
7
  from tensorflow.keras.preprocessing import image
8
  from tensorflow.keras.layers import GlobalMaxPooling2D
9
  from tensorflow.keras.applications.resnet50 import ResNet50, preprocess_input
@@ -41,10 +41,12 @@ def save_uploaded_file(uploaded_file):
41
  def show_dashboard():
42
  st.header("Fashion Recommender System")
43
  chatbot = Chatbot()
 
 
44
  # Load ResNet model for image feature extraction
45
  model = ResNet50(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
46
  model.trainable = False
47
- model = tensorflow.keras.Sequential([
48
  model,
49
  GlobalMaxPooling2D()
50
  ])
@@ -66,18 +68,18 @@ def show_dashboard():
66
  # Recommendation
67
  indices = recommend(features, feature_list)
68
 
69
- # Display recommended products
70
  col1, col2, col3, col4, col5 = st.columns(5)
71
  with col1:
72
- st.image(filenames[indices[0][0]])
73
  with col2:
74
- st.image(filenames[indices[0][1]])
75
  with col3:
76
- st.image(filenames[indices[0][2]])
77
  with col4:
78
- st.image(filenames[indices[0][3]])
79
  with col5:
80
- st.image(filenames[indices[0][4]])
81
 
82
  else:
83
  st.header("Some error occurred in file upload")
 
3
  from PIL import Image
4
  import numpy as np
5
  import pickle
6
+ import tensorflow as tf
7
  from tensorflow.keras.preprocessing import image
8
  from tensorflow.keras.layers import GlobalMaxPooling2D
9
  from tensorflow.keras.applications.resnet50 import ResNet50, preprocess_input
 
41
  def show_dashboard():
42
  st.header("Fashion Recommender System")
43
  chatbot = Chatbot()
44
+ chatbot.load_data()
45
+
46
  # Load ResNet model for image feature extraction
47
  model = ResNet50(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
48
  model.trainable = False
49
+ model = tf.keras.Sequential([
50
  model,
51
  GlobalMaxPooling2D()
52
  ])
 
68
  # Recommendation
69
  indices = recommend(features, feature_list)
70
 
71
+ # Display recommended products using loaded images from the dataset
72
  col1, col2, col3, col4, col5 = st.columns(5)
73
  with col1:
74
+ st.image(chatbot.images[indices[0][0]])
75
  with col2:
76
+ st.image(chatbot.images[indices[0][1]])
77
  with col3:
78
+ st.image(chatbot.images[indices[0][2]])
79
  with col4:
80
+ st.image(chatbot.images[indices[0][3]])
81
  with col5:
82
+ st.image(chatbot.images[indices[0][4]])
83
 
84
  else:
85
  st.header("Some error occurred in file upload")