Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ dependencies:
- captcha==0.5.0
- pyopenms_viz==1.0.0
- streamlit-js-eval
- psutil==7.0.0
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ plotly==5.22.0
captcha==0.5.0
pyopenms_viz==1.0.0
streamlit-js-eval
psutil==7.0.0
21 changes: 18 additions & 3 deletions src/common/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import streamlit as st
import pandas as pd

import psutil
try:
from tkinter import Tk, filedialog

Expand All @@ -23,6 +23,18 @@
# Detect system platform
OS_PLATFORM = sys.platform

@st.fragment(run_every=5)
def monitor_hardware():
cpu_progress = psutil.cpu_percent(interval=None) / 100
ram_progress = 1 - psutil.virtual_memory().available / psutil.virtual_memory().total

st.text(f"Ram ({ram_progress * 100:.2f}%)")
st.progress(ram_progress)

st.text(f"CPU ({cpu_progress * 100:.2f}%)")
st.progress(cpu_progress)

st.caption(f"Last fetched at: {time.strftime('%H:%M:%S')}")

def load_params(default: bool = False) -> dict[str, Any]:
"""
Expand Down Expand Up @@ -211,7 +223,7 @@ def page_setup(page: str = "") -> dict[str, Any]:
if st.session_state.settings["workspaces_dir"] and st.session_state.location == "local":
workspaces_dir = Path(st.session_state.settings["workspaces_dir"], "workspaces-" + st.session_state.settings["repository-name"])
else:
workspace_dir = '..'
workspaces_dir = '..'

# Check if workspace logic is enabled
if st.session_state.settings["enable_workspaces"]:
Expand Down Expand Up @@ -279,6 +291,9 @@ def render_sidebar(page: str = "") -> None:
"""
params = load_params()
with st.sidebar:
with st.expander("📊 **CPU Visualisation**"):
monitor_hardware()

# The main page has workspace switcher
# Display workspace switcher if workspace is enabled in local mode
if st.session_state.settings["enable_workspaces"]:
Expand Down Expand Up @@ -347,7 +362,7 @@ def change_workspace():
"Number of Bins (m/z)", 1, 10000, 50, key="spectrum_num_bins"
)
else:
st.session_state["spectrum_num_bins"] = 50
st.session_state["spectrum_num_bins"] = 50

# Display OpenMS WebApp Template Version from settings.json
with st.container():
Expand Down
Loading