import streamlit as st from config import EMBEDDINGS_DIR from embeddings.search import run_search from embeddings.cluster import run_clustering_pipeline from embeddings.embedder import ( initialize_embedding_model, initialize_chroma, run_pipeline, ) # CONFIGURAÇÃO BÁSICA STREAMLIT st.set_page_config( page_title="Semantic Clusters Dashboard", page_icon="🪐", layout="wide", ) st.title("Semantic Clusters Dashboard") st.markdown("Visualize document clusters with interactive semantic search.") @st.cache_resource def get_embeddings_model(): return initialize_embedding_model() @st.cache_resource def get_vectordb(): embeddings_model = get_embeddings_model() return initialize_chroma(embeddings_model, EMBEDDINGS_DIR) embedding_model = get_embeddings_model() vectordb = get_vectordb() # INTERFACE PRINCIPAL ( tab_ingestion, tab_clusters, tab_search, ) = st.tabs(["Ingestion & Embedding", "3D Clusters", "Semantic Search "]) with tab_ingestion: run_pipeline(force_run=False) with tab_search: run_search(embedding_model=embedding_model, vectordb=vectordb) with tab_clusters: st.header("3D Clusters View") if st.button("🌀 Generate clusters"): with st.spinner("Generating clusters..."): run_clustering_pipeline(embedding_model=embedding_model, vectordb=vectordb) st.success("Clusters!")