Skip to content

JO-Techs/FunctionExtractor

Repository files navigation

Function Extractor

A web application that uses a model to extract and analyze functions from code snippets.

Features

  • 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

Tech Stack

  • Backend: Django, Django REST Framework
  • Frontend: HTML, CSS, Bootstrap 5
  • AI: OpenAI API
  • Database: SQLite (development), PostgreSQL (production)

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/yourusername/function-extractor.git
    cd function-extractor
    
  2. Create and activate a virtual environment:

    python -m venv env
    # On Windows
    env\Scripts\activate
    # On macOS/Linux
    source env/bin/activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Create a .env file in the project root with the following variables:

    OPENAI_API_KEY=your_openai_api_key_here
    DEBUG=True
    SECRET_KEY=your_django_secret_key
    
  5. Run migrations:

    python manage.py migrate
    
  6. Create a superuser:

    python manage.py createsuperuser
    
  7. Load initial programming languages:

    python manage.py loaddata code_analyzer/fixtures/initial_languages.json
    
  8. Start the development server:

    python manage.py runserver
    
  9. Access the application at http://localhost:8000

Usage

  1. Register a new account or login with existing credentials
  2. Navigate to "New Snippet" to add a code snippet
  3. Upload a file or paste code directly
  4. Click "Analyze Code" to extract functions
  5. View the extracted functions and their details
  6. Browse all functions in the "Functions" section

API Endpoints

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors