Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -75,26 +75,25 @@ def get_similar_products_cnn(product_id, num_results):
|
|
75 |
#### Top {num_results} Recommended items
|
76 |
""")
|
77 |
for i in range(1,len(indices)):
|
78 |
-
rows = fashion_df[['ImageURL','ProductTitle']].loc[fashion_df['ProductId']==Productids[indices[i]]]
|
79 |
for indx, row in rows.iterrows():
|
80 |
#image = Image.open(Image(url=row['ImageURL'], width = 224, height = 224,embed=True))
|
81 |
image = Image.open(urllib.request.urlopen(row['ImageURL']))
|
82 |
image = image.resize((224,224))
|
83 |
st.image(image)
|
|
|
84 |
st.write(f"Product Title: {row['ProductTitle']}")
|
85 |
-
st.write(f"Euclidean Distance from input image: {pdists[i]}")
|
86 |
|
87 |
st.write("""
|
88 |
## FashClass Recommendation
|
89 |
"""
|
90 |
)
|
91 |
|
92 |
-
|
93 |
user_input1 = st.text_input("Enter the item id")
|
94 |
user_input2 = st.text_input("Enter number of products to be recommended")
|
95 |
|
96 |
button = st.button('Generate recommendations')
|
97 |
-
st.
|
98 |
-
|
99 |
if button:
|
100 |
get_similar_products_cnn(str(user_input1), int(user_input2))
|
|
|
75 |
#### Top {num_results} Recommended items
|
76 |
""")
|
77 |
for i in range(1,len(indices)):
|
78 |
+
rows = fashion_df[['Gender','ImageURL','ProductTitle']].loc[fashion_df['ProductId']==Productids[indices[i]]]
|
79 |
for indx, row in rows.iterrows():
|
80 |
#image = Image.open(Image(url=row['ImageURL'], width = 224, height = 224,embed=True))
|
81 |
image = Image.open(urllib.request.urlopen(row['ImageURL']))
|
82 |
image = image.resize((224,224))
|
83 |
st.image(image)
|
84 |
+
st.write(f"Gender Class: {row['Gender']}")
|
85 |
st.write(f"Product Title: {row['ProductTitle']}")
|
86 |
+
#st.write(f"Euclidean Distance from input image: {pdists[i]}")
|
87 |
|
88 |
st.write("""
|
89 |
## FashClass Recommendation
|
90 |
"""
|
91 |
)
|
92 |
|
|
|
93 |
user_input1 = st.text_input("Enter the item id")
|
94 |
user_input2 = st.text_input("Enter number of products to be recommended")
|
95 |
|
96 |
button = st.button('Generate recommendations')
|
97 |
+
st.write('---')
|
|
|
98 |
if button:
|
99 |
get_similar_products_cnn(str(user_input1), int(user_input2))
|