A web application that uses a model to extract and analyze functions from code snippets.
- Upload or paste code snippets in various programming languages
- AI-powered function extraction and analysis
- Detailed function information including signature, body, and description
- User authentication and personal code snippet library
- Clean and responsive HTML/CSS interface
- Backend: Django, Django REST Framework
- Frontend: HTML, CSS, Bootstrap 5
- AI: OpenAI API
- Database: SQLite (development), PostgreSQL (production)
-
Clone the repository:
git clone https://github.com/yourusername/function-extractor.git cd function-extractor -
Create and activate a virtual environment:
python -m venv env # On Windows env\Scripts\activate # On macOS/Linux source env/bin/activate -
Install dependencies:
pip install -r requirements.txt -
Create a
.envfile in the project root with the following variables:OPENAI_API_KEY=your_openai_api_key_here DEBUG=True SECRET_KEY=your_django_secret_key -
Run migrations:
python manage.py migrate -
Create a superuser:
python manage.py createsuperuser -
Load initial programming languages:
python manage.py loaddata code_analyzer/fixtures/initial_languages.json -
Start the development server:
python manage.py runserver -
Access the application at http://localhost:8000
- Register a new account or login with existing credentials
- Navigate to "New Snippet" to add a code snippet
- Upload a file or paste code directly
- Click "Analyze Code" to extract functions
- View the extracted functions and their details
- Browse all functions in the "Functions" section
The application also provides a REST API:
/api/languages/- List programming languages/api/snippets/- CRUD operations for code snippets/api/snippets/{id}/analyze/- Analyze a code snippet/api/functions/- List extracted functions