bhaskarhhp commited on
Commit
da26c1a
·
verified ·
1 Parent(s): 5b72b5a

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +25 -22
src/streamlit_app.py CHANGED
@@ -1,29 +1,32 @@
1
  import streamlit as st
 
 
2
 
3
- st.set_page_config(page_title="Styled Form")
4
 
5
- st.markdown("""
6
- <style>
7
- .custom-form {
8
- background-color: #497a78; /* Light blue */
9
- padding: 12px;
10
- border-radius: 10px;
11
- box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
12
- }
13
- </style>
14
- """, unsafe_allow_html=True)
15
 
16
- # Use a container to hold the styled form
17
- with st.container():
18
- st.markdown('<div class="custom-form">', unsafe_allow_html=True)
 
 
19
 
20
- with st.form("my_form"):
21
- st.subheader("📝 Styled Form")
22
- name = st.text_input("Your Name")
23
- age = st.number_input("Your Age", min_value=1)
24
- submitted = st.form_submit_button("Submit")
 
 
 
 
25
 
26
- if submitted:
27
- st.success(f"Hello, {name}! You are {age} years old.")
 
28
 
29
- st.markdown('</div>', unsafe_allow_html=True)
 
 
1
  import streamlit as st
2
+ import subprocess
3
+ import os
4
 
5
+ st.title("Run elestio/docker-desktop-vnc in Docker")
6
 
7
+ # Check and create workspace directory
8
+ workspace_path = os.path.join(os.getcwd(), "knime-workspace")
9
+ os.makedirs(workspace_path, exist_ok=True)
 
 
 
 
 
 
 
10
 
11
+ # Button to run the container
12
+ if st.button("Start VNC Docker Container"):
13
+ try:
14
+ # Stop existing container if running
15
+ subprocess.run(["docker", "rm", "-f", "vnc-container"], stderr=subprocess.DEVNULL)
16
 
17
+ # Run the container
18
+ result = subprocess.run([
19
+ "docker", "run", "-d",
20
+ "--name", "vnc-container",
21
+ "-p", "8080:80",
22
+ "-e", "RESOLUTION=1280x800",
23
+ "-v", f"{workspace_path}:/root/knime-workspace",
24
+ "elestio/docker-desktop-vnc"
25
+ ], capture_output=True, text=True, check=True)
26
 
27
+ container_id = result.stdout.strip()
28
+ st.success(f"Docker container started successfully! ID: {container_id}")
29
+ st.markdown("[Open VNC in browser](http://localhost:8080)", unsafe_allow_html=True)
30
 
31
+ except subprocess.CalledProcessError as e:
32
+ st.error(f"Error starting container: {e.stderr}")