Spaces:
Sleeping
Sleeping
File size: 634 Bytes
c83b762 47aaf42 c83b762 47aaf42 c83b762 47aaf42 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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"))
|