-
Project context: This interface will help you extract information from every document you need to given a prompt and json extraction template for visualization. It uses different Open-source OCR and OpenAI API key to extract the result from the text.
-
Prepare
- Activate your venv (or create one):
- macOS/Linux:
source .venv/bin/activate - Windows (PowerShell):
.venv\Scripts\Activate
- macOS/Linux:
- Install deps:
pip install -r requirements.txt
- Activate your venv (or create one):
-
Run UI
python app/run_app.pyβ http://localhost:8501
For the Streamlit interface:
python app/run_app.py βββ resources
| βββ prompts.py # Contains the prompts in dict
| βββ OCR.py # Centralize OCR method
|
βββ autogen3.13 - virtual env
|
βββ results - local db to temporarily store results
| βββ XXX.json # extraction results
| βββ XXX.txt # OCR extraction results
| βββ XXX.prompt # Prompt used
|
βββ app - Streamlit interface application
| βββ run_app.py # Launch to run the app, check the needs
| βββ streamlit_app.py # Application definition
|
βββ requirements.txt # Library resources
βββ README.md # Explanation and informationSet the python version with pyenv
pyenv install 3.13
pyenv local 3.13Add to PATH (if not already done):
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
source ~/.zshrcIt will create the .python-version containing the following version
Create the virtual environment with :
py -3.13 -m venv .venv #Name whatever you wantTry to use the most recent of python, I tried to use an older version and got the a different interface with less options.
Activate the virtual environment :
.venv\Scripts\activate # On Windows
or
source .venv/bin/activate # On macOS/LinuxIf it worked you should see in your console something like :
(.venv) PS C:\Users\admin\Documents\limpide autogen>The (...) specify your python environment
And now you should be able to select the environment in your IDE
Select it in VS code/Cursor :
- Open Command Palette (Ctrl + Shift + P)
- Type
>Python : Select Interpreter - Select your environment (e.g :
.venv)
Install project dependencies:
pip install -r requirements.txt
# Try this if failed on autogen-agenchat
pip install -U "autogen-agentchat" "autogen-ext[openai]"- Tesseract OCR (with English + French models):
- macOS:
brew install tesseract tesseract-lang - Ubuntu/Debian:
sudo apt-get install tesseract-ocr tesseract-ocr-fra tesseract-ocr-eng - Windows: installer from the UB Mannheim page
- macOS:
- Poppler (for
pdf2imagePDF rendering):- macOS:
brew install poppler - Ubuntu/Debian:
sudo apt-get install poppler-utils
- macOS:
You can self host your model via Ollama or Lmstudio if you need UI. I will maybe add it.
