CodeMentorAI / app.py
nandunelapatla's picture
Upload app.py
a6bac4c verified
raw
history blame contribute delete
772 Bytes
import streamlit as st
from backend import explain_code, debug_code, ask_question
st.set_page_config(page_title="CodeMentor AI", layout="wide")
st.title("🤖 CodeMentor AI")
tab1, tab2, tab3 = st.tabs(["Explain Code", "Fix Code", "Ask AI"])
with tab1:
code = st.text_area("Paste your Python code")
if st.button("Explain Code"):
with st.spinner("Explaining..."):
st.success(explain_code(code))
with tab2:
code = st.text_area("Paste code to debug")
if st.button("Fix Code"):
with st.spinner("Analyzing..."):
st.success(debug_code(code))
with tab3:
question = st.text_input("Ask your question")
if st.button("Ask AI"):
with st.spinner("Thinking..."):
st.success(ask_question(question))