Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from backend import explain_code, debug_code, ask_question
|
| 3 |
+
|
| 4 |
+
st.set_page_config(page_title="CodeMentor AI", layout="wide")
|
| 5 |
+
st.title("🤖 CodeMentor AI")
|
| 6 |
+
|
| 7 |
+
tab1, tab2, tab3 = st.tabs(["Explain Code", "Fix Code", "Ask AI"])
|
| 8 |
+
|
| 9 |
+
with tab1:
|
| 10 |
+
code = st.text_area("Paste your Python code")
|
| 11 |
+
if st.button("Explain Code"):
|
| 12 |
+
with st.spinner("Explaining..."):
|
| 13 |
+
st.success(explain_code(code))
|
| 14 |
+
|
| 15 |
+
with tab2:
|
| 16 |
+
code = st.text_area("Paste code to debug")
|
| 17 |
+
if st.button("Fix Code"):
|
| 18 |
+
with st.spinner("Analyzing..."):
|
| 19 |
+
st.success(debug_code(code))
|
| 20 |
+
|
| 21 |
+
with tab3:
|
| 22 |
+
question = st.text_input("Ask your question")
|
| 23 |
+
if st.button("Ask AI"):
|
| 24 |
+
with st.spinner("Thinking..."):
|
| 25 |
+
st.success(ask_question(question))
|