CoolFace
Apppublic

kpmuks2709/cobol-rag-lineage

sourceHugging Faceupdated 10mo agoView on Hugging Face
0likes
App README

COBOL RAG Lineage Q&A System

A RAG (Retrieval-Augmented Generation) system for querying COBOL codebase using natural language.

Setup

1. Install Dependencies

bash
pip install -r requirements.txt

2. Set OpenAI API Key

bash
export OPENAI_API_KEY='your-api-key-here'

Or on Windows:

cmd
set OPENAI_API_KEY=your-api-key-here

3. Initialize the System (First Time Only)

bash
python RAG_lineage_POC_v2.py

This will:

  • —Generate descriptions for all COBOL files
  • —Create embeddings and FAISS index
  • —Save metadata

Note: This step may take several minutes depending on the number of COBOL files.

Running the Application

Quick Start (Recommended)

On Mac/Linux:

bash
./run.sh

On Windows:

cmd
run.bat

Or manually:

bash
python app.py

Access Options

  1. 1.Local Access: http://localhost:7860 (only on your machine)
  1. 1.Public Shareable Link: The app automatically creates a public link when you run it. You'll see output like:
   Running on local URL:  http://127.0.0.1:7860
   Running on public URL: https://xxxxx.gradio.live

Share the public URL with others to give them access. The link is active as long as your server is running.

Usage

  1. 1.Initialize System (if not already done):
  2. 2.Go to "Initialize System" tab
  3. 3.Click "Initialize RAG System" button
  4. 4.Wait for completion
  1. 1.Query COBOL Code:
  2. 2.Go to "Query COBOL Code" tab
  3. 3.Enter your question
  4. 4.Click "Submit Query"
  5. 5.View the response

Example Queries

  • —"What are the input and output variables in transaction processing programs?"
  • —"Which files handle user authentication?"
  • —"Show me files that process account data"
  • —"What are the main functions in the COBOL codebase?"

Project Structure

Lineage_RAG_POC_V2/
├── app.py                      # Gradio web interface
├── RAG_lineage_POC_v2.py      # Main RAG logic
├── requirements.txt            # Python dependencies
├── cobol_files/               # COBOL source files
├── faiss_cobol_v2.index       # FAISS vector index (generated)
├── cobol_metadata_v2.json     # Metadata (generated)
└── Cobol_code_desc_v2.csv     # Descriptions (generated)

Troubleshooting

  • —Import Error: Make sure all dependencies are installed: pip install -r requirements.txt
  • —FAISS Index Not Found: Run initialization first: python RAG_lineage_POC_v2.py
  • —API Key Error: Ensure OPENAI_API_KEY environment variable is set
  • —Port Already in Use: Change the port in app.py: server_port=7861