import joblib def load_model_and_vectorizer(): model = joblib.load('model.pkl') vectorizer = joblib.load('vectorizer.pkl') return model, vectorizer def predict(text): model, vectorizer = load_model_and_vectorizer() text_vectorized = vectorizer.transform([text]) prediction = model.predict(text_vectorized) return prediction[0] if __name__ == '__main__': # Example usage text = "Ejemplo de declaración" result = predict(text) print(f"Categoría predicha: {result}")