Spaces:
Sleeping
Sleeping
Download pages/coding_challenges.py from Ashar086/Open_AI_o1_Hackathon: direct link, hf CLI and curl.
- Browser
- Download file 959 Bytes
-
https://huggingface.co/spaces/Ashar086/Open_AI_o1_Hackathon/resolve/main/pages/coding_challenges.py
- Command line
-
hf download hf://spaces/Ashar086/Open_AI_o1_Hackathon/pages/coding_challenges.py
-
curl -L -o coding_challenges.py https://huggingface.co/spaces/Ashar086/Open_AI_o1_Hackathon/resolve/main/pages/coding_challenges.py
959 Bytes
| 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) | |