import gradio as gr import joblib # Load model and vectorizer model = joblib.load("final_emotion_model.pkl") vectorizer = joblib.load("final_vectorizer.pkl") # Define accuracy (hardcoded or loaded from a file) model_accuracy = 0.9974 # Define prediction function def predict_emotion(text): text_vec = vectorizer.transform([text]) prediction = model.predict(text_vec)[0] return f"Prediction: {prediction}" # Add accuracy info in the description or title 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()