File size: 772 Bytes
a6bac4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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))