Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from bertopic import BERTopic | |
| # Load the trained BERTopic model | |
| model_path = "TarekAi/ArBERTopic" | |
| topic_model = BERTopic.load(model_path) | |
| # Streamlit app | |
| st.title("BERTopic Inference") | |
| st.write("Enter a single idea to get the predicted topic and its probabilities.") | |
| document = st.text_area("Enter your idea here...", height=200) | |
| if st.button("Predict Topic"): | |
| if document: | |
| topics, probabilities = topic_model.transform([document]) | |
| st.write(f"Predicted Topic: {topics[0]}") | |
| st.write(f"Probabilities: {probabilities[0].tolist()}") | |
| else: | |
| st.write("Please enter a valid idea.") |