How nestor20193767/testmedgan works
Project type and purpose
• This is a lightweight, single‐page Streamlit application for document question answering.
• Users upload a document; the app processes it, queries OpenAI’s GPT‐3.5, and returns answers.
File structure
• Top‐level:
• streamlit_app.py – main entry point (UI + backend logic)
• modelos/modelo_entrenado.pth – a local PyTorch model (e.g., for embeddings or preprocessing)
• config.toml & .streamlit/config.toml – Streamlit and app configuration
• requirements.txt – Python dependencies (including streamlit, torch, openai)
• .devcontainer – dev environment definition
• No separate “frontend” vs. “backend” folders; the code is monolithic but logically splits into UI (Streamlit) and processing layers.
README for additional insights
• Confirms: install requirements, run streamlit run streamlit_app.py.
• Uses OpenAI GPT-3.5 via API.
• No DB or caching; ephemeral in‐memory flow.
Main components & interactions
a. Streamlit UI Layer (streamlit_app.py)
• File‐upload widget
• Of questions and answers
b. Document Processing Pipeline
• File parser (PDF/TXT reader)
• Text chunking & vectorization (using modelo_entrenado.pth)
c. Query Engine
• Calls OpenAI API with context + user question
d. Configuration Layer
• Reads API keys and settings from config.toml / environment
e. External Service
• OpenAI GPT‐3.5
f. (Optional) Local Model Store
• modelos/modelo_entrenado.pth
Relationships & data flow
• User → Streamlit UI → Document parser → Chunker/Embedder → Query Engine → OpenAI API → Streamlit UI → User
• Config read occurs at startup and feeds both embedding and OpenAI calls.
• The local model is loaded once into memory and used by the pipeline.
Architectural patterns & design principles
• Monolithic but logically layered: presentation, processing, external integration.
• Single responsibility per module: UI vs. parsing vs. API client.
• Configuration‐driven (via TOML) for environment‐specific overrides.
• Containerized dev environment for reproducibility (.devcontainer).