from transformers import pipeline import gradio as gr from nltk.sentiment.vader import SentimentIntensityAnalyzer import nltk nltk.download('vader_lexicon') from deep_translator import (GoogleTranslator) from langdetect import detect zero_shot_classifier = pipeline("zero-shot-classification" , model='roberta-large-mnli') spam_detector = pipeline("text-classification", model="madhurjindal/autonlp-Gibberish-Detector-492513457") issues = ["Misconduct" , "Negligence" , "Discrimination" , "Corruption" , "Violation of Rights" , "Inefficiency" , "Unprofessional Conduct", "Response Time" , "Use of Firearms" , "Property Damage"] apprecn = ["Tech-Savvy Staff" , "Co-operative Staff" , "Well-Maintained Premises" , "Responsive Staff"] def translate(input_text): source_lang = detect(input_text) translated = GoogleTranslator(source=source_lang, target='en').translate(text=input_text) return translated def spam_detection(input_text): return spam_detector(input_text)[0]['label'] == 'clean' def sentiment_analysis(input_text): score = SentimentIntensityAnalyzer().polarity_scores(input_text) if score['neg']>score['pos']: return ["Negative Feedback" , score['neg']] elif score['neg']