Spaces:
Sleeping
Sleeping
Updating app.py
Browse files
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
|
| 7 |
-
st.set_page_config(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 15 |
-
lang_col,
|
|
|
|
| 16 |
with lang_col:
|
| 17 |
-
selected_lang = st.selectbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
#
|
| 24 |
colors, ace_theme = apply_theme()
|
| 25 |
|
| 26 |
-
# Layout: Editor + Chatbot
|
| 27 |
-
|
| 28 |
-
|
|
|
|
| 29 |
st.subheader("Editor")
|
| 30 |
editor_key = f"editor_{selected_lang}"
|
| 31 |
render_code_editor(selected_lang, ace_theme, editor_key)
|
| 32 |
|
| 33 |
-
with
|
| 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
|