import streamlit as st import pandas as pd import re import tensorflow as tf import tensorflow_hub as hub import joblib def load_model(): # Correct the path to your model return tf.keras.models.load_model('path_to_my_model', custom_objects={'KerasLayer': hub.KerasLayer}) model = load_model() # Correct the path to your label encoder label_encoder = joblib.load('label_encoder.joblib') st.title('Transaction Category Predictor') user_input = st.text_input("Enter a transaction description:") if user_input: processed_input = re.sub(r'\d+', '', user_input) input_df = pd.DataFrame([processed_input], columns=['transaction_desc']) prediction = model.predict(input_df['transaction_desc']) predicted_category_index = prediction.argmax() predicted_category = label_encoder.inverse_transform([predicted_category_index])[0] st.write(f"Predicted Category: {predicted_category}")