Spaces:
Runtime error
Runtime error
Commit
·
455d32c
1
Parent(s):
39a3ca0
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,15 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
@st.cache
|
| 4 |
-
def get_syntax(text):
|
| 5 |
-
return text + '\n'
|
| 6 |
|
| 7 |
-
|
| 8 |
-
code
|
|
|
|
| 9 |
|
| 10 |
-
if st.button('Write code'):
|
| 11 |
-
with st.spinner('Writing code...'):
|
| 12 |
-
syntax = get_syntax(code)
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import os
|
| 3 |
+
import subprocess
|
| 4 |
+
import sys
|
| 5 |
+
import time
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
def write_code(code):
|
| 9 |
+
with open('code.py', 'w') as f:
|
| 10 |
+
f.write(code)
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
def run_code():
|
| 14 |
+
subprocess.run(['python', 'code.py'])
|
| 15 |
+
|