How piyushdhoka/drdo_docxsummarizer works
Project type and purpose
• This is a full-stack Python application with a Streamlit-based UI (app.py) and a FastAPI backend (fastapi_app.py).
• It ingests documents, uses utility modules (file_reader.py, pdf_reader.py) to parse them, then runs a summarization routine and returns results to the UI.
File structure
Top-level components:
• app.py – streamlit frontend
• fastapi_app.py – FastAPI server
• backend.py – orchestration between FastAPI and utils (optional entrypoint)
• utils/ – document-processing helpers
• tests/ – environment and integration tests
• .devcontainer/ – container setup for local development
• start_services.bat – script to launch both UI and API
README insights
• Two services must run in parallel: Streamlit UI & FastAPI backend.
• Interaction is via HTTP (UI calls the API).
• Dependencies are defined in requirements.txt.
Main components & their interactions
a. Components:
– User’s Browser (or local host)
– Streamlit UI (app.py)
– FastAPI Backend (fastapi_app.py)
– Document Processing Utilities (utils/file_reader.py, utils/pdf_reader.py)
– Summarization Engine (external library, e.g., Hugging Face or custom model)
– Local Filesystem (where docs reside)
– Development Container (.devcontainer)
– Tests (tests/test_env.py)
b. Data flows and relationships:
1. User uploads/selects document in Streamlit UI.
2. UI makes HTTP POST to FastAPI endpoint.
3. FastAPI handler invokes backend logic (backend.py) or directly calls utils/.
4. File is read via file_reader; if PDF, it goes through pdf_reader.
5. Text is passed to the summarization engine.
6. Summary returned to FastAPI, then relayed back to UI.
7. UI displays the summary.
c. Architectural patterns/principles:
– Clear separation of concerns (UI vs. API vs. utils).
– Single-responsibility for each module.
– Modular utility functions for parsing.
– Containerization support via .devcontainer.
d. Key technologies:
– Streamlit (frontend)
– FastAPI + Uvicorn (backend server)
– Python utilities for file & PDF handling
– Summarization library (specified in requirements.txt)
Putting it all together
• Top layer: User’s Browser → Streamlit UI (app.py)
• Middle layer: FastAPI backend (fastapi_app.py / backend.py)
• Bottom layer:
– Utils: file_reader.py → pdf_reader.py
– Summarizer (external library)
– Local filesystem
• Test flow: highlight tests invoking environment setup