robertselvam commited on
Commit
2b08e0e
·
verified ·
1 Parent(s): 9e3c485

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -20,17 +20,18 @@ from streamlit.runtime.scriptrunner import get_script_run_ctx
20
 
21
  # return getpass.getuser()
22
 
23
- import getpass
24
 
25
- def get_remote_ip():
26
  try:
27
- username = getpass.getuser()
 
28
  return username
29
  except Exception as e:
30
  return str(e)
31
 
32
  # Example usage
33
- st.write(get_remote_ip())
34
 
35
 
36
  class ContextFilter(logging.Filter):
 
20
 
21
  # return getpass.getuser()
22
 
23
+ import subprocess
24
 
25
+ def get_current_username():
26
  try:
27
+ result = subprocess.run(['whoami'], capture_output=True, text=True)
28
+ username = result.stdout.strip()
29
  return username
30
  except Exception as e:
31
  return str(e)
32
 
33
  # Example usage
34
+ st.write(get_current_username())
35
 
36
 
37
  class ContextFilter(logging.Filter):