class_docstr: A frontend for wrapping Streamlit code in your LightingFlow.
  
  Return this in your `LightningFlow.configure_layout()` method if you wish to build the UI with ``streamlit``.
  To use this frontend, you must first install the `streamlit` package (if running locally):
  
  .. code-block:: bash
  
      pip install streamlit
  
  Arguments:
      render_fn: A function that contains your streamlit code. This function must accept exactly one argument, the
          `AppState` object which you can use to access variables in your flow (see example below).
  
  Example:
  
      In your LightningFlow, override the method `configure_layout`:
  
      .. code-block:: python
  
          class MyFlow(LightningFlow):
              def __init__(self):
                  super().__init__()
                  self.counter = 0
  
              def configure_layout(self):
                  return StreamlitFrontend(render_fn=my_streamlit_ui)
  
  
          # define this function anywhere you want
          # this gets called anytime the UI needs to refresh
          def my_streamlit_ui(state):
              import streamlit as st
  
              st.write("Hello from streamlit!")
              st.write(state.counter)
class_docstr_tok: ["A","frontend","for","wrapping","Streamlit","code","in","your","LightingFlow",".","Return","this","in","your","`","LightningFlow.configure_layout","(",")","`","method","if","you","wish","to","build","the","UI","with","``","streamlit","``",".","To","use","this","frontend",",","you","must","first","install","the","`","streamlit","`","package","(","if","running","locally",")",":","..","code-block",":",":","bash","pip","install","streamlit","Arguments",":","render_fn",":","A","function","that","contains","your","streamlit","code",".","This","function","must","accept","exactly","one","argument",",","the","`","AppState","`","object","which","you","can","use","to","access","variables","in","your","flow","(","see","example","below",")",".","Example",":","In","your","LightningFlow",",","override","the","method","`","configure_layout","`",":","..","code-block",":",":","python","class","MyFlow","(","LightningFlow",")",":","def","__init__","(","self",")",":","super","(",")",".__init__","(",")","self.counter","=","0","def","configure_layout","(","self",")",":","return","StreamlitFrontend","(","render_fn=my_streamlit_ui",")","#","define","this","function","anywhere","you","want","#","this","gets","called","anytime","the","UI","needs","to","refresh","def","my_streamlit_ui","(","state",")",":","import","streamlit","as","st","st.write","(","``","Hello","from","streamlit","!","''",")","st.write","(","state.counter",")"]
code: def stop_server(self) -> None:
      if self._process is None:
          raise RuntimeError(
              "Server is not running. Call `StreamlitFrontend.start_server()` first."
          )
      self._process.kill()
  
file_path: pytorch-lightning/src/lightning/app/frontend/stream_lit.py
imports: import inspect
  import os
  import subprocess
  import sys
  from typing import Callable, Optional
  import lightning.app
  from lightning.app.frontend.frontend import Frontend
  from lightning.app.utilities.cloud import is_running_in_cloud
  from lightning.app.utilities.imports import requires
  from lightning.app.utilities.log import get_logfile
label_desc: Use image node_id 3 for calling the StreamlitFrontend obj's underlying member method code with example usage: obj.stop_server() without return types