Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -83,7 +83,7 @@ def score(main_product, main_url, search, logger, log_area):
|
|
83 |
|
84 |
cosine_sim_scores = []
|
85 |
|
86 |
-
logger.write("\n\nCreating Similar product Embeddings
|
87 |
log_area.text(logger.getvalue())
|
88 |
|
89 |
for product in data:
|
@@ -107,23 +107,23 @@ st.title("Product Infringement Checker")
|
|
107 |
# Inputs
|
108 |
main_product = st.text_input('Enter Main Product Name', 'Philips led 7w bulb')
|
109 |
main_url = st.text_input('Enter Main Product Manual URL', 'https://www.assets.signify.com/is/content/PhilipsConsumer/PDFDownloads/Colombia/technical-sheets/ODLI20180227_001-UPD-es_CO-Ficha_Tecnica_LED_MR16_Master_7W_Dim_12V_CRI90.pdf')
|
110 |
-
|
111 |
|
112 |
if st.button('Check for Infringement'):
|
113 |
log_output = st.empty() # Placeholder for log output
|
114 |
|
115 |
with st.spinner('Processing...'):
|
116 |
with StreamCapture() as logger:
|
117 |
-
score(main_product, main_url,
|
118 |
|
119 |
st.success('Processing complete!')
|
120 |
|
121 |
st.subheader("Cosine Similarity Scores")
|
122 |
|
123 |
-
|
124 |
tags = ['Introduction', 'Specifications', 'Product Overview', 'Safety Information', 'Installation Instructions', 'Setup and Configuration', 'Operation Instructions', 'Maintenance and Care', 'Troubleshooting', 'Warranty Information', 'Legal Information']
|
125 |
|
126 |
for product, link, index, value in cosine_sim_scores:
|
127 |
if not index:
|
128 |
st.write(f"Product: {product}, Link: {link}")
|
129 |
-
st.write(f"{tags[index]:<20} Cosine Similarity Score: {value:.2f}")
|
|
|
83 |
|
84 |
cosine_sim_scores = []
|
85 |
|
86 |
+
logger.write("\n\nCreating Similar product Embeddings ---------->\n")
|
87 |
log_area.text(logger.getvalue())
|
88 |
|
89 |
for product in data:
|
|
|
107 |
# Inputs
|
108 |
main_product = st.text_input('Enter Main Product Name', 'Philips led 7w bulb')
|
109 |
main_url = st.text_input('Enter Main Product Manual URL', 'https://www.assets.signify.com/is/content/PhilipsConsumer/PDFDownloads/Colombia/technical-sheets/ODLI20180227_001-UPD-es_CO-Ficha_Tecnica_LED_MR16_Master_7W_Dim_12V_CRI90.pdf')
|
110 |
+
search_method = st.selectbox('Choose Search Engine', ['duckduckgo', 'google', 'archive', 'github', 'wikipedia', 'all'])
|
111 |
|
112 |
if st.button('Check for Infringement'):
|
113 |
log_output = st.empty() # Placeholder for log output
|
114 |
|
115 |
with st.spinner('Processing...'):
|
116 |
with StreamCapture() as logger:
|
117 |
+
cosine_sim_scores, main_result = score(main_product, main_url, search_method, logger, log_output)
|
118 |
|
119 |
st.success('Processing complete!')
|
120 |
|
121 |
st.subheader("Cosine Similarity Scores")
|
122 |
|
123 |
+
# = score(main_product, main_url, search, logger, log_output)
|
124 |
tags = ['Introduction', 'Specifications', 'Product Overview', 'Safety Information', 'Installation Instructions', 'Setup and Configuration', 'Operation Instructions', 'Maintenance and Care', 'Troubleshooting', 'Warranty Information', 'Legal Information']
|
125 |
|
126 |
for product, link, index, value in cosine_sim_scores:
|
127 |
if not index:
|
128 |
st.write(f"Product: {product}, Link: {link}")
|
129 |
+
st.write(f"{tags[index]:<20} Cosine Similarity Score: {value:.2f}")
|