mellowFluff/Explicit-Lyrics-Classifier
0
1import pickle2import gradio as gr3 4model_pkl_file = "/content/explicit_lyrics_classifier.pkl" 5 6with open(model_pkl_file, 'rb') as file: 7 Model = pickle.load(file)8 9def pred_lyrics(input):10 label_mapping = label_mapping = {0: 'non-explicit', 1: 'explicit'}11 input = [input]12 pred = Model.predict(input)13 label_ex = [label_mapping[label] for label in pred]14 return label_ex15 16iface = gr.Interface(fn = pred_lyrics, inputs = "text", outputs = "text", title = "Explicit Lyrics Classifier")17 18iface.launch(inline = False)