import streamlit as st from transformers import pipeline from sentence_transformers import SentenceTransformer # Load the Sentence Transformers model model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2') # Load the website classification model (replace 'Suphawan/website_classification' with your actual 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'] # Compute sentence embeddings sentence_embeddings = model.encode([text]) st.write("Category:", category) st.write("Confidence:", confidence) st.write("Sentence Embeddings:", sentence_embeddings) if __name__ == "__main__": main()