RFP_Analyzer_Agent / utils /processing_helpers.py
cryogenic22's picture
Create processing_helpers.py
df245f3 verified
import multiprocessing
import streamlit as st
def get_optimal_workers():
"""Get optimal number of workers based on CPU cores."""
return max(multiprocessing.cpu_count() - 1, 1)
def display_performance_metrics():
"""Display current system performance metrics."""
st.sidebar.markdown("### System Performance")
available_cores = multiprocessing.cpu_count()
used_cores = st.sidebar.slider(
"CPU Cores to Use",
min_value=1,
max_value=available_cores,
value=get_optimal_workers(),
help="Adjust the number of CPU cores used for processing"
)
return {
'used_cores': used_cores,
'total_cores': available_cores
}