Graphical apps#

After installing the user extra, run pymedphys gui to launch the Streamlit app selector. See the installation guide for environment setup. App-specific connections and configuration may also be required.

Serving the apps#

By default, pymedphys gui listens only on the loopback address 127.0.0.1, so only the computer that runs it can connect. It also restricts the WebSocket connections used to run the apps to requests addressed to localhost or 127.0.0.1, protecting those connections against DNS rebinding. It turns off Streamlit’s usage statistics.

To serve other computers, for example from a department server, pass the address to listen on with --address. This serves every IPv4 interface on port 8501:

pymedphys gui --address 0.0.0.0 --port 8501

Warning

The apps have no login and handle patient data. Anyone who can reach the address and port can use every app and download its outputs, and the connection is unencrypted HTTP. Serve on another address only on a network where that is acceptable.

With --address, Streamlit accepts WebSocket connections addressed to any host name. To accept only the names that clients use, set server.allowedHosts in Streamlit’s configuration file, .streamlit/config.toml in the home directory of the user who runs the GUI:

[server]
allowedHosts = ["physics-server", "physics-server.example.org"]

pymedphys gui passes server.address, browser.gatherUsageStats, and, without --address, server.allowedHosts to Streamlit on the command line, so these settings override Streamlit’s configuration files and environment variables.

Command line options#

usage: pymedphys gui [-h] [--port PORT] [--address ADDRESS] [--electron]

Named Arguments#

--port

Port to serve the GUI on. Defaults to Streamlit’s default port.

--address

Network address to serve the GUI on, for example 0.0.0.0 for every IPv4 interface. By default the GUI listens on 127.0.0.1, so only this computer can connect. WARNING: the GUI has no authentication and its apps handle patient data. Anyone who can reach this address and port can use every app and download its outputs, and the connection is unencrypted HTTP. Serve on another address only on a network where that is acceptable.

--electron

Default: False