Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,24 @@ import subprocess
|
|
4 |
# Set page configuration
|
5 |
st.set_page_config(page_title="Advanced Terminal Emulator", layout="wide")
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
# Main title
|
8 |
st.title("🎨 Advanced Terminal Emulator")
|
9 |
|
@@ -23,10 +41,10 @@ def run_command(command):
|
|
23 |
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
24 |
if result.stdout:
|
25 |
st.subheader("Output:")
|
26 |
-
st.
|
27 |
if result.stderr:
|
28 |
st.subheader("Error:")
|
29 |
-
st.
|
30 |
except Exception as e:
|
31 |
st.error(f"An error occurred: {e}")
|
32 |
|
|
|
4 |
# Set page configuration
|
5 |
st.set_page_config(page_title="Advanced Terminal Emulator", layout="wide")
|
6 |
|
7 |
+
# Custom CSS for output and error background colors
|
8 |
+
st.markdown("""
|
9 |
+
<style>
|
10 |
+
.output {
|
11 |
+
background-color: #d4edda; /* Green background for output */
|
12 |
+
padding: 10px;
|
13 |
+
border-radius: 5px;
|
14 |
+
border: 1px solid #c3e6cb;
|
15 |
+
}
|
16 |
+
.error {
|
17 |
+
background-color: #f8d7da; /* Red background for error */
|
18 |
+
padding: 10px;
|
19 |
+
border-radius: 5px;
|
20 |
+
border: 1px solid #f5c6cb;
|
21 |
+
}
|
22 |
+
</style>
|
23 |
+
""", unsafe_allow_html=True)
|
24 |
+
|
25 |
# Main title
|
26 |
st.title("🎨 Advanced Terminal Emulator")
|
27 |
|
|
|
41 |
result = subprocess.run(command, shell=True, capture_output=True, text=True)
|
42 |
if result.stdout:
|
43 |
st.subheader("Output:")
|
44 |
+
st.markdown(f'<div class="output">{result.stdout}</div>', unsafe_allow_html=True)
|
45 |
if result.stderr:
|
46 |
st.subheader("Error:")
|
47 |
+
st.markdown(f'<div class="error">{result.stderr}</div>', unsafe_allow_html=True)
|
48 |
except Exception as e:
|
49 |
st.error(f"An error occurred: {e}")
|
50 |
|