| | import gradio as gr |
| | import joblib |
| |
|
| | |
| | model = joblib.load("final_emotion_model.pkl") |
| | vectorizer = joblib.load("final_vectorizer.pkl") |
| |
|
| | |
| | model_accuracy = 0.9974 |
| |
|
| | |
| | def predict_emotion(text): |
| | text_vec = vectorizer.transform([text]) |
| | prediction = model.predict(text_vec)[0] |
| | return f"Prediction: {prediction}" |
| |
|
| | |
| | iface = gr.Interface( |
| | fn=predict_emotion, |
| | inputs="text", |
| | outputs="text", |
| | title="Emotional Manipulation Detector", |
| | description=f"Detects manipulative intent in messages. Model accuracy: {model_accuracy*100:.2f}%" |
| | ) |
| |
|
| | iface.launch() |
| |
|