DineshKumar1329 commited on
Commit
3acca25
·
verified ·
1 Parent(s): 476aa0f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +1 -26
README.md CHANGED
@@ -19,30 +19,5 @@ The sentiment analysis model is trained using a Support Vector Machine (SVM) cla
19
 
20
  # Usage :
21
 
22
- from huggingface_hub import hf_hub_download
23
- import joblib
24
- from sklearn.preprocessing import LabelEncoder
25
-
26
- model = joblib.load(
27
- hf_hub_download("DineshKumar1329/Sentiment_Analysis", "sklearn_model.joblib")
28
- )
29
- tfidf_vectorizer = joblib.load('/content/vectorizer_model.joblib') # Replace with your path
30
-
31
- def clean_text(text):
32
- return text.lower()
33
-
34
- def predict_sentiment(user_input):
35
- """Predicts sentiment for a given user input."""
36
- cleaned_text = clean_text(user_input)
37
- input_matrix = tfidf_vectorizer.transform([cleaned_text])
38
- prediction = model.predict(input_matrix)[0]
39
- if isinstance(model.classes_, LabelEncoder):
40
- prediction = model.classes_.inverse_transform([prediction])[0]
41
- return prediction
42
-
43
- user_input = input("Enter a sentence: ")
44
- predicted_sentiment = predict_sentiment(user_input)
45
- print(f"Predicted Sentiment: {predicted_sentiment}")
46
-
47
-
48
 
 
19
 
20
  # Usage :
21
 
22
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/65dd9dc387458446d0a9da32/MlAfwDkAouKP5iWtzqHPj.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23