Spaces:
Sleeping
Sleeping
Commit ·
24ba471
1
Parent(s): 9039db6
Added correct vercel.json for Streamlit Vercel deployment
Browse files- create_dummy_model.py +31 -0
create_dummy_model.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# create_dummy_model.py
|
| 2 |
+
import os
|
| 3 |
+
import joblib
|
| 4 |
+
from sklearn.pipeline import Pipeline
|
| 5 |
+
from sklearn.feature_extraction.text import CountVectorizer
|
| 6 |
+
from sklearn.linear_model import LogisticRegression
|
| 7 |
+
|
| 8 |
+
# Create artifacts directory if it doesn't exist
|
| 9 |
+
os.makedirs("artifacts", exist_ok=True)
|
| 10 |
+
|
| 11 |
+
# Simple pipeline for demo purposes
|
| 12 |
+
pipeline = Pipeline([
|
| 13 |
+
("vectorizer", CountVectorizer()),
|
| 14 |
+
("classifier", LogisticRegression())
|
| 15 |
+
])
|
| 16 |
+
|
| 17 |
+
# Train the dummy model on small sample data
|
| 18 |
+
texts = [
|
| 19 |
+
"I love this product",
|
| 20 |
+
"This is great",
|
| 21 |
+
"Amazing experience",
|
| 22 |
+
"I hate this",
|
| 23 |
+
"This is bad",
|
| 24 |
+
"Terrible quality",
|
| 25 |
+
]
|
| 26 |
+
labels = ["positive", "positive", "positive", "negative", "negative", "negative"]
|
| 27 |
+
pipeline.fit(texts, labels)
|
| 28 |
+
|
| 29 |
+
# Save model artifact
|
| 30 |
+
joblib.dump(pipeline, "artifacts/sentiment_pipeline.joblib")
|
| 31 |
+
print("✅ Dummy sentiment model created at artifacts/sentiment_pipeline.joblib")
|