Sign inSign up

fybre/document-analyzer

By fybre

•Updated about 1 year ago

A Python-based web application for analyzing uploaded documents using an LLM

Image
0

1.0K

fybre/document-analyzer repository overview

šŸ“ docker-compose.yml

version: '3.8'

services:
  document-analyzer:
    image: fybre/document-analyzer:latest
    ports:
      - "8000:8000"
    env_file:
      - .env
    volumes:
      - ./temp_uploads:/app/temp_uploads #OPTIONAL
    restart: unless-stopped

šŸ“ .env file (same directory as docker-compose.yml) .env

LLM_BACKEND=azure
LLM_MODEL=gpt-35-turbo
AZURE_OPENAI_KEY=your-azure-api-key
AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/
AZURE_DEPLOYMENT_NAME=your-deployment-name

Replace the values with your actual configuration. You can also use OpenAI or Ollama by changing LLM_BACKEND and providing relevant keys or access.

ā ā–¶ļø Run with Docker Compose

docker-compose up Access the API at: http://localhost:8000/docs⁠

ā šŸ”‘ Environment Variables

You can configure these directly or via a .env file.

Variable Description

LLM_BACKEND azure, openai, or ollama

LLM_MODEL Model name (llama2, gpt-4, gpt-35-turbo, etc.)

OPENAI_API_KEY OpenAI API key (if using OpenAI backend)

AZURE_OPENAI_KEY Azure API key (if using Azure backend)

AZURE_OPENAI_ENDPOINT Azure OpenAI endpoint

AZURE_DEPLOYMENT_NAME Azure deployment name

ā šŸ“¬ API Usage
POST /analyze

Upload a document and receive analysis as structured JSON.

šŸ“ Parameters

file: (required) File upload (.pdf or .txt)

additional_llm_prompt: (optional) Extra context or task instruction

custom_system_prompt: (optional) Override the default system prompt

⁠🧠 Output Format

Responses follow a strict JSON schema, for example:

{
    "document_type": "resume",
    "score": 85,
    "summary": {
	    "concise": "Experienced software engineer.",
	    "detailed": "The document describes a senior developer with experience in Python..."
    },
    "recommendations": "Add specific skills to improve score.",
    "error": {
	    "code": "",
	    "message": null
    }
}

Tag summary

Content type

Image

Digest

sha256:875ce3dc8…

Size

73.1 MB

Last updated

about 1 year ago

docker pull fybre/document-analyzer