import gradio as gr from transformers import AutoModelForSequenceClassification, AutoTokenizer def lyrics_categories(input_text): spotify_model = "spotify/autonlp-huggingface-demo-song-lyrics-18923587" model = AutoModelForSequenceClassification.from_pretrained(spotify_model, use_auth_token=True) tokenizer = AutoTokenizer.from_pretrained(spotify_model, use_auth_token=True) inputs = tokenizer(input_text, return_tensors="pt") outputs = model(**inputs) return outputs return clean_outputs iface = gr.Interface(fn=lyrics_categories, inputs=gr.inputs.Textbox(lines=7, placeholder="Enter song lyrics here..."), outputs="text") iface.launch()