Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -67,7 +67,7 @@ d = {'GPT Commands': ['GOOGLE("question")', 'PYTHON(script.py)', 'MAKEFILE("cont
|
|
67 |
}
|
68 |
df = pd.DataFrame(data=d, dtype='string')
|
69 |
commandTable = st.experimental_data_editor(df, use_container_width=True, num_rows='dynamic')
|
70 |
-
st.markdown('### Upload/Download \n(note that this is a public server, uploaded files are visible to others)')
|
71 |
uploadFile = st.file_uploader('')
|
72 |
cola, colb, colc = st.columns(3)
|
73 |
with cola:
|
@@ -108,7 +108,7 @@ def askGPT(input):
|
|
108 |
return resp
|
109 |
|
110 |
def runCmd(flag):
|
111 |
-
if flag:
|
112 |
with st.spinner('Running command \'' + st.session_state['command'] + '\''):
|
113 |
try:
|
114 |
p = subprocess.Popen(st.session_state['command'], shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
|
@@ -116,9 +116,10 @@ def runCmd(flag):
|
|
116 |
st.session_state['followupPrompt'] = 'Response: ' + p.communicate()[0].decode("utf-8")
|
117 |
except subprocess.CalledProcessError as e:
|
118 |
st.session_state['followupPrompt'] = 'Response: ' + e.output.decode("utf-8")
|
|
|
|
|
119 |
else:
|
120 |
st.session_state['followupPrompt'] = "Response: User rejected this command"
|
121 |
-
st.session_state['followup'], st.session_state['running'] = True, True
|
122 |
st.session_state['followup'], st.session_state['running'] = True, True
|
123 |
st.experimental_rerun()
|
124 |
|
|
|
67 |
}
|
68 |
df = pd.DataFrame(data=d, dtype='string')
|
69 |
commandTable = st.experimental_data_editor(df, use_container_width=True, num_rows='dynamic')
|
70 |
+
st.markdown('### Upload/Download \n(note that this is a public server, uploaded files are visible to others and periodically deleted)')
|
71 |
uploadFile = st.file_uploader('')
|
72 |
cola, colb, colc = st.columns(3)
|
73 |
with cola:
|
|
|
108 |
return resp
|
109 |
|
110 |
def runCmd(flag):
|
111 |
+
if flag and (not st.session_state['command'].startswith('rm '))):
|
112 |
with st.spinner('Running command \'' + st.session_state['command'] + '\''):
|
113 |
try:
|
114 |
p = subprocess.Popen(st.session_state['command'], shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
|
|
|
116 |
st.session_state['followupPrompt'] = 'Response: ' + p.communicate()[0].decode("utf-8")
|
117 |
except subprocess.CalledProcessError as e:
|
118 |
st.session_state['followupPrompt'] = 'Response: ' + e.output.decode("utf-8")
|
119 |
+
elif st.session_state['command'].startswith('rm '):
|
120 |
+
st.session_state['followupPrompt'] = "Response: Rm command disabled on HuggingFace"
|
121 |
else:
|
122 |
st.session_state['followupPrompt'] = "Response: User rejected this command"
|
|
|
123 |
st.session_state['followup'], st.session_state['running'] = True, True
|
124 |
st.experimental_rerun()
|
125 |
|