Spaces:
Sleeping
Sleeping
| import subprocess | |
| import torch | |
| import streamlit as st | |
| import streamlit_ace | |
| try: | |
| for i in range(torch.cuda.device_count()): | |
| st.text(torch.cuda.get_device_properties(i).name) | |
| except: | |
| st.text("Could not get device properties") | |
| input_user = "" | |
| with st.form("input code"): | |
| code: str = streamlit_ace.st_ace(auto_update=True) | |
| if st.form_submit_button("run code"): | |
| prossess = subprocess.run( | |
| code.rstrip().split(), shell=True, capture_output=True | |
| ) | |
| st.text(prossess.stdout.decode("utf-8")) | |
| if prossess.returncode == 0: | |
| st.error(prossess.stderr.decode("utf-8")) | |