Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,7 +62,7 @@ def find_exact_matches(df1, df2, column_name):
|
|
| 62 |
return matches
|
| 63 |
|
| 64 |
|
| 65 |
-
def find_similar_texts(df1, df2, column_name, exact_matches, threshold=0.
|
| 66 |
# Find rows with similar texts in the specified column, excluding exact matches
|
| 67 |
similar_texts = []
|
| 68 |
exact_match_indices = set(exact_matches.index.tolist())
|
|
@@ -116,22 +116,24 @@ def main():
|
|
| 116 |
warehouse_column = st.selectbox("Choose column from warehouse item stocks:", warehouse_columns)
|
| 117 |
industry_column = st.selectbox("Choose column from industry item stocks:", industry_columns)
|
| 118 |
|
| 119 |
-
#
|
| 120 |
-
|
|
|
|
|
|
|
| 121 |
|
| 122 |
-
|
| 123 |
-
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
|
| 136 |
if __name__ == "__main__":
|
| 137 |
main()
|
|
|
|
| 62 |
return matches
|
| 63 |
|
| 64 |
|
| 65 |
+
def find_similar_texts(df1, df2, column_name, exact_matches, threshold=0.3):
|
| 66 |
# Find rows with similar texts in the specified column, excluding exact matches
|
| 67 |
similar_texts = []
|
| 68 |
exact_match_indices = set(exact_matches.index.tolist())
|
|
|
|
| 116 |
warehouse_column = st.selectbox("Choose column from warehouse item stocks:", warehouse_columns)
|
| 117 |
industry_column = st.selectbox("Choose column from industry item stocks:", industry_columns)
|
| 118 |
|
| 119 |
+
# Compare button
|
| 120 |
+
if st.button("Compare"):
|
| 121 |
+
# Find exact matches
|
| 122 |
+
exact_matches = find_exact_matches(warehouse_df, industry_df, warehouse_column)
|
| 123 |
|
| 124 |
+
# Find similar texts
|
| 125 |
+
similar_texts = find_similar_texts(warehouse_df, industry_df, warehouse_column, exact_matches)
|
| 126 |
|
| 127 |
+
# Display results
|
| 128 |
+
st.header("Exact Matches")
|
| 129 |
+
st.write(exact_matches)
|
| 130 |
|
| 131 |
+
st.header("Similar Texts")
|
| 132 |
+
for text_pair in similar_texts:
|
| 133 |
+
st.write(f"Row {text_pair[0]} in warehouse item stocks is similar to Row {text_pair[1]} in industry item stocks:")
|
| 134 |
+
st.write(f"Warehouse: {text_pair[2]}")
|
| 135 |
+
st.write(f"Industry: {text_pair[3]}")
|
| 136 |
+
st.write("")
|
| 137 |
|
| 138 |
if __name__ == "__main__":
|
| 139 |
main()
|