Rainess commited on
Commit
1719ac4
1 Parent(s): 1362a53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -9,7 +9,7 @@ from transformers import pipeline
9
  summarizer = pipeline("summarization", model="Falconsai/text_summarization")
10
 
11
  # Load the text classification model pipeline
12
- classifier = pipeline("text-classification", model='Rainess/Finturned-Music-Sentiment', return_all_scores=True)
13
 
14
  def summary_song(text):
15
  input_length = len(text)
@@ -38,10 +38,7 @@ if st.button("Summarize and Classify"):
38
  # Perform text classification on the summarized text
39
  classification_results = classifier(summarized_text)
40
 
41
- # Get the highest scoring sentiment
42
- max_score = float('-inf')
43
- max_label = ''
44
-
45
 
46
  # Map label to sentiment
47
  sentiment = "Positive" if max_label == "1" else "Negative"
@@ -50,7 +47,7 @@ if st.button("Summarize and Classify"):
50
  st.write("Original Lyrics:", text)
51
  st.write("Summarized Text:", summarized_text)
52
  st.write("Sentiment:", sentiment)
53
- st.write("Score:", max_score)
54
  else:
55
  st.write("Please enter some lyrics to summarize and classify.")
56
 
 
9
  summarizer = pipeline("summarization", model="Falconsai/text_summarization")
10
 
11
  # Load the text classification model pipeline
12
+ classifier = pipeline("text-classification", model='Rainess/Finturned-Music-Sentiment')
13
 
14
  def summary_song(text):
15
  input_length = len(text)
 
38
  # Perform text classification on the summarized text
39
  classification_results = classifier(summarized_text)
40
 
41
+
 
 
 
42
 
43
  # Map label to sentiment
44
  sentiment = "Positive" if max_label == "1" else "Negative"
 
47
  st.write("Original Lyrics:", text)
48
  st.write("Summarized Text:", summarized_text)
49
  st.write("Sentiment:", sentiment)
50
+
51
  else:
52
  st.write("Please enter some lyrics to summarize and classify.")
53