Subida inicial del modelo
Browse files- inference.py +15 -0
- requirements.txt +5 -0
inference.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pickle
|
| 2 |
+
from sklearn.feature_extraction.text import TfidfVectorizer
|
| 3 |
+
|
| 4 |
+
# Cargar el modelo y el vectorizador
|
| 5 |
+
with open('vectorizer.pkl', 'rb') as f:
|
| 6 |
+
vectorizer = pickle.load(f)
|
| 7 |
+
|
| 8 |
+
with open('model.pkl', 'rb') as f:
|
| 9 |
+
model = pickle.load(f)
|
| 10 |
+
|
| 11 |
+
def predict(text):
|
| 12 |
+
# Preprocesar el texto usando el vectorizador
|
| 13 |
+
X = vectorizer.transform([text])
|
| 14 |
+
# Hacer una predicción usando el modelo
|
| 15 |
+
return model.predict(X)
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas
|
| 2 |
+
scikit-learn
|
| 3 |
+
imbalanced-learn
|
| 4 |
+
joblib
|
| 5 |
+
numpy
|