Spaces:
Runtime error
Runtime error
| 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() | |