This app is built using Streamlit and provides interactive coding and multiple-choice question practice for machine learning and deep learning topics. It is designed to help interview candidates practice key concepts, algorithms, and techniques by generating coding challenges and questions on-demand.
-
Coding Practice
- Choose from a list of top ML and DL algorithms and concepts (e.g., Linear Regression, K-Means, Self Attention). #TODO: Add more algorithms and concepts, perhaps add a free flowing text field
- Set a coding intensity level to determine how much of the code you want to write yourself (from 0% to 100%).
- Choose to implement the algorithm from scratch or using standard libraries (e.g.,
scikit-learnfor machine learning algorithms). - Receive generated code from a Large Language Model (LLM) that matches the selected intensity level.
- Edit, run, and test the code directly in the Streamlit app, mimicking an IDE-like experience.
- Use "Explain This Code" to get a detailed explanation of the code.
-
Multiple Choice Questions
- Select the number of questions and difficulty level (easy, medium, or hard).
- Practice answering multiple-choice questions generated by an LLM on the selected topic.
- Get instant feedback on answers with color-coded results.
- Review your final score at the end of each quiz.
- Request explanations for questions to deepen your understanding.
-
New Features
- Improved code syntax highlighting
- Safer code execution environment
- Better error handling for LLM responses
- Configurable settings via environment variables
- Enhanced UI with responsive design
ai-ml-code-interviewer/
├── app.py # Main application entry point
├── modules/ # Contains all the module files
│ ├── coding_module.py # Coding practice functionality
│ ├── help_module.py # Help and documentation functionality
│ ├── history_manager.py # Session history management
│ ├── quiz_module.py # Quiz functionality
│ ├── llm_service.py # LLM API interaction service
│ ├── code_executor.py # Safe code execution environment
│ ├── settings_module.py # Settings management
│ └── utils.py # Utility functions
├── config/ # Configuration settings
│ ├── .app_settings.json # Application settings
│ ├── .env.example # Example environment variables
│ ├── .secrets.baseline # Secrets detection baseline
│ ├── config.py # Configuration settings
│ ├── dev-requirements.txt # Development dependencies
│ └── requirements.txt # Project dependencies
├── dev-requirements.txt # Development dependencies
├── .github/ # GitHub workflow files
├── .pre-commit-config.yaml# Pre-commit configuration
├── styles/ # CSS styles
│ └── app.css # Application styles
├── user_history/ # Session history files
└── Readme.md # Project documentation
To set up and run this app locally, follow these steps:
-
Clone the repository:
git clone https://github.com/analyticsbot/deep-learning.git cd ai-ml-code-interviewer -
Install dependencies:
Make sure you have Python 3.7+ installed. First, create and activate a virtual environment:
# Create virtual environment python -m venv venv # Activate virtual environment # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
Install the required packages:
pip install -r requirements.txt
-
Set up environment variables:
Copy the
.env.examplefile to.envand update the settings as needed:cp .env.example .env
Edit the
.envfile to configure your LLM API keys based on which provider you want to use:# For OpenAI OPENAI_API_KEY=your_openai_key_here # For Anthropic ANTHROPIC_API_KEY=your_anthropic_key_here # For Google Gemini GOOGLE_API_KEY=your_google_key_here # For Grok GROK_API_KEY=your_grok_key_hereIMPORTANT: The
.envfile contains sensitive API keys and should NEVER be committed to version control. It is already included in the .gitignore file. DO NOT remove it from .gitignore as this would expose your API keys to others.All other configuration settings (LLM_PROVIDER, LLM_BASE_URL, LLM_MODEL, LLM_TEMPERATURE) are stored in the .app_settings.json file, which is safe to commit as it does not contain any sensitive information.
WARNING: NEVER share your
.envfile or commit it to any public repository. Always keep it secure and private. -
Run the Streamlit app:
streamlit run app.py
- Navigate to the "Coding Practice" tab
- Select a topic from the dropdown menu (e.g., "Linear Regression")
- Adjust the coding intensity slider (0% for full code, 100% for skeleton)
- Choose implementation approach ("From Scratch" or "Using Standard Package")
- Click "Get Code" to generate code from the LLM
- Edit the code in the text area
- Click "Run Code" to execute and see results
- Use "Explain This Code" to get a detailed explanation
- Navigate to the "Multiple Choice Questions" tab
- Select a topic, number of questions, and difficulty level
- Click "Get Questions" to generate a quiz
- Select your answers for each question
- Click "Submit Answers" to check your results
- Review your score and correct/incorrect answers
- Click "Explain" buttons to get explanations for specific questions
- Use "Start New Quiz" to generate a new set of questions
The "Settings" tab allows you to:
- View current LLM configuration
- Toggle code execution (for security reasons)
- Learn more about the application
The "Help" tab provides detailed documentation and guides for using the application.
- Code execution is disabled by default for security (can be enabled in settings)
- Restricted execution environment when running user code
- Input validation and sanitization for LLM prompts
- Error handling for LLM API calls
streamlit>=1.22.0: Interactive UI frameworkrequests>=2.28.2: HTTP requestsopenai>=1.0.0: OpenAI-compatible API clientpython-dotenv>=1.0.0: Environment variable managementpydantic>=2.0.0: Data validationmarkdown>=3.4.3: Markdown processingpygments>=2.15.0: Code syntax highlightinganthropic>=0.5.0: Anthropic API client (optional)google-generativeai>=0.3.0: Google Gemini API client (optional)streamlit_ace>=0.1.0: Code editor component for Streamlit
- Ensure your LM Studio server is running at the configured endpoint, if you're using the local server
- For the LLM such as OpenAI, Anthropic, and Google Gemini, verify API key is configured in the
.envfile
- Make sure code execution is enabled in settings if you want to run code
- Check for syntax errors in your code
- Some libraries may not be available in the restricted execution environment
- Try refreshing the page if UI elements are not responding
- Check Streamlit version compatibility
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.



