A web-based tool that converts Python code into high-performance C++ using LLMs (GPT-4o / Claude 3.5). It also lets you run and compare outputs of both Python and the optimized C++ implementation.
- Convert Python functions to optimized, low-latency C++.
- Support for OpenAI GPT-4o and Anthropic Claude 3.5 Sonnet models.
- Live code execution and output comparison for both Python and C++.
- Built-in web interface powered by Gradio.
- Auto-generates
optimized.cppand compiles using Clang with performance flags. - Stylish, modern UI with clean execution results.
- Gradio
- OpenAI Python SDK
- Anthropic Python SDK
- Python dotenv
- C++17 + Clang (via subprocess)
Run the following commands in your terminal:
git clone https://github.com/frezazadeh/LLM-based-Python-to-Cpp.git
cd python-to-cpp-ai
pip install -r requirements.txtCreate a file named .env in the project root and add the following content:
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_claude_api_keyRun the application with:
python3 main.py