Spaces:
Running
Running
Update pages/coding_challenges.py
Browse files
pages/coding_challenges.py
CHANGED
@@ -1,19 +1,25 @@
|
|
1 |
import streamlit as st
|
2 |
-
from components.challenge_eval import evaluate_challenge
|
3 |
from components.feedback import get_ai_feedback
|
4 |
|
5 |
def show_coding_challenges():
|
6 |
st.title("Solve Coding Challenges")
|
7 |
|
|
|
8 |
problem = "Implement a linear regression model from scratch."
|
9 |
st.write(f"Problem: {problem}")
|
10 |
|
|
|
11 |
user_code = st.text_area("Write your solution here:", height=300)
|
12 |
|
13 |
if st.button("Submit Solution"):
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
16 |
|
17 |
if st.button("Get AI Feedback"):
|
|
|
18 |
feedback = get_ai_feedback(user_code)
|
19 |
st.write(feedback)
|
|
|
|
1 |
import streamlit as st
|
|
|
2 |
from components.feedback import get_ai_feedback
|
3 |
|
4 |
def show_coding_challenges():
|
5 |
st.title("Solve Coding Challenges")
|
6 |
|
7 |
+
# Display the coding challenge problem
|
8 |
problem = "Implement a linear regression model from scratch."
|
9 |
st.write(f"Problem: {problem}")
|
10 |
|
11 |
+
# Input area for user to write the solution
|
12 |
user_code = st.text_area("Write your solution here:", height=300)
|
13 |
|
14 |
if st.button("Submit Solution"):
|
15 |
+
# Simple validation of the code structure (replace with more advanced logic if needed)
|
16 |
+
if "def" in user_code and "return" in user_code:
|
17 |
+
st.success("Great! Your code structure seems correct.")
|
18 |
+
else:
|
19 |
+
st.error("It looks like there's an issue with your code. Make sure to define a function and return a result.")
|
20 |
|
21 |
if st.button("Get AI Feedback"):
|
22 |
+
# Get AI feedback on the user's code
|
23 |
feedback = get_ai_feedback(user_code)
|
24 |
st.write(feedback)
|
25 |
+
|