import streamlit as st from components.feedback import get_ai_feedback def show_coding_challenges(): st.title("Solve Coding Challenges") # Display the coding challenge problem problem = "Implement a linear regression model from scratch." st.write(f"Problem: {problem}") # Input area for user to write the solution user_code = st.text_area("Write your solution here:", height=300) if st.button("Submit Solution"): # Simple validation of the code structure (replace with more advanced logic if needed) if "def" in user_code and "return" in user_code: st.success("Great! Your code structure seems correct.") else: st.error("It looks like there's an issue with your code. Make sure to define a function and return a result.") if st.button("Get AI Feedback"): # Get AI feedback on the user's code feedback = get_ai_feedback(user_code) st.write(feedback)