Spaces:
Runtime error
Runtime error
Commit
·
97fa3b6
1
Parent(s):
03442c3
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,32 +43,32 @@ def main():
|
|
| 43 |
st.title("Spend Classification App :smiley:")
|
| 44 |
|
| 45 |
# Define pages
|
| 46 |
-
pages = ["spend classification"]
|
| 47 |
|
| 48 |
# Add radio buttons to toggle between pages
|
| 49 |
-
page = st.sidebar.radio("Select a page", pages)
|
| 50 |
|
| 51 |
|
| 52 |
-
if page == pages[0]:
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
|
| 69 |
-
|
| 70 |
|
| 71 |
-
|
| 72 |
|
| 73 |
if __name__ == "__main__":
|
| 74 |
main()
|
|
|
|
| 43 |
st.title("Spend Classification App :smiley:")
|
| 44 |
|
| 45 |
# Define pages
|
| 46 |
+
#pages = ["spend classification"]
|
| 47 |
|
| 48 |
# Add radio buttons to toggle between pages
|
| 49 |
+
#page = st.sidebar.radio("Select a page", pages)
|
| 50 |
|
| 51 |
|
| 52 |
+
#if page == pages[0]:
|
| 53 |
+
st.header("Spend Classification")
|
| 54 |
+
st.write("Enter a product description:")
|
| 55 |
+
st.write("e.g. Key Features of Alisha Solid Women's Cycling Shorts Cotton Lycra Navy, Red, Navy,Specifications of Alisha Solid Women's Cycling Shorts Shorts Details Number of Contents in Sales Package Pack of 3 Fabric Cotton Lycra Type Cycling Shorts General Details Pattern Solid Ideal For Women's Fabric Care Gentle Machine Wash in Lukewarm Water, Do Not Bleach Additional Details Style Code ALTHT_3P_21 In the Box 3 shorts")
|
| 56 |
+
input_string = st.text_input("")
|
| 57 |
|
| 58 |
+
|
| 59 |
|
| 60 |
+
if st.button("Enter"):
|
| 61 |
+
st.write("classification is:")
|
| 62 |
+
pred = get_prediction(input_string)
|
| 63 |
|
| 64 |
+
categories = pred.split(" >> ")
|
| 65 |
+
formatted_output = []
|
| 66 |
+
for i, category in enumerate(categories, 1):
|
| 67 |
+
formatted_output.append(f'Hierarchy {i} classification: {category}')
|
| 68 |
|
| 69 |
+
for line in formatted_output:
|
| 70 |
|
| 71 |
+
st.write(line)
|
| 72 |
|
| 73 |
if __name__ == "__main__":
|
| 74 |
main()
|