Spaces:
Build error
Build error
File size: 700 Bytes
df245f3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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
} |