soflexpoc / inference.py
delineiro's picture
Actualizaci贸n de modelo
0ae2381 verified
raw
history blame contribute delete
535 Bytes
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锟絥"
result = predict(text)
print(f"Categor锟絘 predicha: {result}")