https://github.com/andredisa/ai-codesolver
π» AI_CodeSolver is an intelligent assistant for developers, students, and coding enthusiasts, helping with learning, solving algorithmic problems, and debugging code.
https://github.com/andredisa/ai-codesolver
ai-architecture codesolutions flask gemini openai python sandbox
Last synced: 4 months ago
JSON representation
π» AI_CodeSolver is an intelligent assistant for developers, students, and coding enthusiasts, helping with learning, solving algorithmic problems, and debugging code.
- Host: GitHub
- URL: https://github.com/andredisa/ai-codesolver
- Owner: andredisa
- License: mit
- Created: 2025-05-06T13:05:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-19T12:41:53.000Z (about 1 year ago)
- Last Synced: 2025-06-22T22:02:50.739Z (about 1 year ago)
- Topics: ai-architecture, codesolutions, flask, gemini, openai, python, sandbox
- Language: Python
- Homepage:
- Size: 23.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π§ **AI_CodeSolver** π€
> Welcome to **AI_CodeSolver**! π This is a powerful Python project that leverages state-of-the-art AI models to help you solve coding problems automatically! Whether you're a beginner or an expert, this tool will assist you in generating optimal solutions and executing them in a safe sandbox environment.
>π§ **AI_CodeSolver** uses OpenAI's GPT-3, Google's Gemini, and E2B sandbox environments to analyze coding problems, generate solutions, and run them in real-time.
---
## π§βπ» **Features** β¨
- **πΈ Image Processing**: Upload an image of a coding problem, and the system will extract the problem description using advanced image recognition (powered by Gemini).
- **π Text Input**: You can also directly type your coding problem.
- **π» Code Generation**: The AI will generate a clean, efficient, and documented Python solution for your coding problem.
- **π Code Execution**: Execute the generated solution in a secure sandbox environment, and get real-time results.
- **π Safe Environment**: Run potentially unsafe or untrusted Python code without worrying about security issues using the E2B sandbox.
- **β‘ Optimized for LeetCode-like Problems**: Designed to handle typical coding challenges with proper time and space complexity.
---
## π» **Installation** π
### Prerequisites π
1. **Python 3.x** installed on your machine.
2. **API keys** for OpenAI, Gemini, and E2B (sandbox execution).
### Steps to Set Up π οΈ
1. **Clone the Repository**:
```bash
git clone https://github.com/andredisa/AI_CodeSolver.git
cd AI_CodeSolver
```
2. **Create a Virtual Environment** (optional but recommended):
```bash
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. **Install Dependencies**:
```bash
pip install -r requirements.txt
```
4. **Set Up API Keys** π:
- Create a `.env` file in the project root directory (same level as this README).
- Add your API keys in this format:
```ini
OPENAI_API_KEY=your-openai-api-key
GEMINI_API_KEY=your-gemini-api-key
E2B_API_KEY=your-e2b-api-key
```
Make sure you never push your `.env` file to GitHub for security reasons! π
5. **Run the Application**:
Start the app with Streamlit:
```bash
streamlit run app/ui.py
```
Your application will open in your browser! π
---
## π₯οΈ **How to Use** π€
1. **Input Coding Problem**:
- You can **upload an image** of a coding problem or directly **type** the problem in the text box.
2. **Generate & Execute**:
- Once youβve entered the problem, hit the **"Generate & Execute Solution"** button to let the AI generate a solution and run the code.
3. **Review the Results**:
- The AI will return the solution with a breakdown of the code.
- The generated code will be executed in the E2B sandbox, and youβll get the results right on the platform.
4. **Check Files** (if any):
- If the execution creates any files, theyβll be listed below the execution results for you to download.
---
## π¨ **UI/UX Overview** π‘
- **Sidebar Configuration**: On the left side, configure your **API keys** for OpenAI, Gemini, and E2B.
- **Main Area**:
- Input your coding problem as text or upload an image.
- Get the AI-generated solution along with the execution results.
- **Real-time Feedback**: See step-by-step execution logs and any generated files right after the code runs.
---
## π§ **Technologies Used** βοΈ
- **Streamlit**: The frontend framework to build the web interface.
- **OpenAI GPT-3**: Used for generating Python solutions.
- **Google Gemini**: For analyzing and extracting coding problems from images.
- **E2B Sandbox**: A secure environment to run Python code without any security concerns.
---
## π¦ **File Structure** ποΈ
Hereβs an overview of the project structure:
```bash
AI_CodeSolver/
β
βββ app/ # Main application code
β βββ init.py
β βββ ui.py # UI code (Streamlit app)
β βββ agents.py # Agents for AI interactions (OpenAI, Gemini)
β βββ sandbox.py # Sandbox management
β βββ image_processing.py # Image processing (Gemini API)
β
βββ .env # Your sensitive API keys (don't upload this to GitHub)
βββ .env.example # Example .env file
βββ .gitignore # Ignore sensitive files (e.g., .env)
βββ requirements.txt # List of Python dependencies
```
## π€© **Contribute** π¬
We welcome contributions! π If you have ideas for improvements, bug fixes, or new features, feel free to:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature-name`).
3. Commit your changes (`git commit -am 'Add new feature'`).
4. Push to the branch (`git push origin feature-name`).
5. Open a Pull Request.
---
## π **License** π
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
## β Support Me
If you find my work useful and would like to support me, you can buy me a coffee! Your support helps me keep creating and improving my projects. Thank you! π
---
## π **Enjoy solving problems with AI CodeSolver!** π
