File size: 535 Bytes
efa14e3 0ae2381 efa14e3 0ae2381 efa14e3 0ae2381 efa14e3 0ae2381 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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}")
|