File size: 802 Bytes
63de922
 
 
9878bcf
63de922
 
 
020ebc6
63de922
 
 
 
 
 
 
020ebc6
 
 
 
63de922
020ebc6
63de922
 
 
 
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
import streamlit as st
from transformers import pipeline

# Load the sentiment analysis model
classifier = pipeline("sentiment-analysis", model="Suphawan/website_classification")

def main():
    st.title("Website Classification")

    with st.form("text_field"):
        text = st.text_area('Enter some text:')
        # clicked will be True only when the button is clicked
        clicked = st.form_submit_button("Submit text")

        if clicked:
            # Perform website classification
            classification_results = classifier([text])
            category = classification_results[0]['label']
            confidence = classification_results[0]['score']

            st.write("Category:", category)
            st.write("Confidence:", confidence)

if __name__ == "__main__":
    main()