vsj0702 commited on
Commit
1a89634
Β·
verified Β·
1 Parent(s): 089452f

Updating app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -12
app.py CHANGED
@@ -3,34 +3,44 @@ from layout import init_session_state, apply_theme
3
  from code_editor import render_code_editor
4
  from chatbot import render_chatbot
5
 
6
- # Page Setup
7
- st.set_page_config(page_title="Pro Code Playground", page_icon="πŸ’»", layout="wide")
 
 
 
 
8
  init_session_state()
9
 
10
- # Header
11
  st.title("Pro Code Playground")
12
  st.markdown("Write, execute & export multi-language snippets, with built‑in AI assistance.")
13
 
14
- # Language + Theme selection
15
- lang_col, spacer, theme_col = st.columns([3, 6, 1])
 
16
  with lang_col:
17
- selected_lang = st.selectbox("Language", ["Python", "C", "C++", "Java", "JavaScript", "C#"], index=0)
 
 
 
 
18
 
19
  with theme_col:
20
  theme_choice = st.radio("Theme", options=["β˜€οΈ", "πŸŒ™"], horizontal=True, label_visibility="collapsed")
21
  st.session_state.dark_mode = (theme_choice == "πŸŒ™")
22
 
23
- # Apply theme
24
  colors, ace_theme = apply_theme()
25
 
26
- # Layout: Editor + Chatbot
27
- gen, bot = st.columns((2, 1), gap="large")
28
- with gen:
 
29
  st.subheader("Editor")
30
  editor_key = f"editor_{selected_lang}"
31
  render_code_editor(selected_lang, ace_theme, editor_key)
32
 
33
- with bot:
34
  st.subheader("Code Assistant")
35
  render_chatbot(
36
  st.session_state.code,
@@ -38,7 +48,7 @@ with bot:
38
  st.session_state.get("error_output", "")
39
  )
40
 
41
- # Footer
42
  st.markdown("""
43
  <div style='text-align:center; margin-top:1rem; opacity:0.6;'>
44
  Built with ❀️ & Streamlit by Vaibhav
 
3
  from code_editor import render_code_editor
4
  from chatbot import render_chatbot
5
 
6
+ # ── Page Config ──────────────────────────────
7
+ st.set_page_config(
8
+ page_title="Pro Code Playground",
9
+ page_icon="πŸ’»",
10
+ layout="wide"
11
+ )
12
  init_session_state()
13
 
14
+ # ── Header ───────────────────────────────────
15
  st.title("Pro Code Playground")
16
  st.markdown("Write, execute & export multi-language snippets, with built‑in AI assistance.")
17
 
18
+ # ── Language & Theme Selection ───────────────
19
+ lang_col, _, theme_col = st.columns([3, 6, 1])
20
+
21
  with lang_col:
22
+ selected_lang = st.selectbox(
23
+ "Language",
24
+ ["Python", "C", "C++", "Java", "JavaScript", "C#"],
25
+ index=0
26
+ )
27
 
28
  with theme_col:
29
  theme_choice = st.radio("Theme", options=["β˜€οΈ", "πŸŒ™"], horizontal=True, label_visibility="collapsed")
30
  st.session_state.dark_mode = (theme_choice == "πŸŒ™")
31
 
32
+ # ── Theme Colors ─────────────────────────────
33
  colors, ace_theme = apply_theme()
34
 
35
+ # ── Main Layout: Editor (2/3) + Chatbot (1/3) ─
36
+ editor_col, assistant_col = st.columns((2, 1), gap="large")
37
+
38
+ with editor_col:
39
  st.subheader("Editor")
40
  editor_key = f"editor_{selected_lang}"
41
  render_code_editor(selected_lang, ace_theme, editor_key)
42
 
43
+ with assistant_col:
44
  st.subheader("Code Assistant")
45
  render_chatbot(
46
  st.session_state.code,
 
48
  st.session_state.get("error_output", "")
49
  )
50
 
51
+ # ── Footer ───────────────────────────────────
52
  st.markdown("""
53
  <div style='text-align:center; margin-top:1rem; opacity:0.6;'>
54
  Built with ❀️ & Streamlit by Vaibhav