Update app.py
Browse files
app.py
CHANGED
@@ -20,17 +20,18 @@ from streamlit.runtime.scriptrunner import get_script_run_ctx
|
|
20 |
|
21 |
# return getpass.getuser()
|
22 |
|
23 |
-
import
|
24 |
|
25 |
-
def
|
26 |
try:
|
27 |
-
|
|
|
28 |
return username
|
29 |
except Exception as e:
|
30 |
return str(e)
|
31 |
|
32 |
# Example usage
|
33 |
-
st.write(
|
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):
|