File size: 730 Bytes
513a379
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import streamlit as st
from transformers import pipeline

text_classifier = pipeline("text-classification", model="nlptown/bert-base-multilingual-uncased-sentiment")

def main():
    st.title("Know The Mood of Your Writing")
    
    # Text input area for the user
    text = st.text_area("Enter your text:")

    if st.button("Go!"):
        if text:
            analyze_text_tone(text)
        else:
            st.warning("Please enter some text.")

def analyze_text_tone(text):
    classification_result = text_classifier(text)
    predicted_label = classification_result[0]['label']
    
    st.subheader("Text Tone Analysis Result:")
    st.write(f"Predicted Tone: {predicted_label}")

if __name__ == "__main__":
    main()