A full-stack AI application that uses a locally hosted LLaMA model (via Ollama) to summarize text.
Built with a Python backend (FastAPI) and a user-friendly frontend (Streamlit).
Developed as part of Internship Task #1
- FastAPI Backend: Acts as the bridge between the user and the AI model.
- Streamlit Frontend: A clean, interactive web interface for users to input text.
- Local Inference: Runs entirely offline using Ollama (no API keys required!).
- Model Agnostic: Can easily switch between
llama2,llama3, or lightweight models likephi3.
```mermaid flowchart TD A[User] -->|Enters text| B[Streamlit Frontend] B -->|Sends HTTP request| C[FastAPI Backend] C -->|Sends prompt| D[Ollama Local Model Runner] D -->|Runs inference| E["LLaMA / Phi3 Model (Local)"] E -->|Returns summary| D D -->|Returns response| C C -->|Sends JSON response| B B -->|Displays summary| A ```
Flow explanation:
- The user enters text into the Streamlit UI.
- Streamlit sends the text to the FastAPI backend via an HTTP request.
- FastAPI forwards the prompt to Ollama, which runs the selected local LLM.
- The model generates a summary, which flows back through FastAPI to Streamlit.
- The summarized text is displayed to the user.
- Python 3.10+
- Ollama (Model Runner)
- FastAPI (Backend API)
- Streamlit (Frontend UI)
- Uvicorn (ASGI Server)
Running local AI models requires decent hardware. Here is what you need to run this smoothly:
| Requirement | Minimum | Recommended |
|---|---|---|
| RAM | 8GB | 16GB |
| GPU | Not required | NVIDIA GPU with CUDA |
| Storage | 4GB free space | 4GB+ free space |
Note: If you have 8GB RAM, close your browser tabs before running the model! Without a GPU, the model will run on your CPU — it works, but text generation will be slower.
Download and install Ollama from ollama.com.
Open your terminal and download the model. Use phi3 or llama2 depending on your RAM.
```bash ollama pull phi3
ollama pull llama2 ```
```bash git clone https://github.com//llama-text-summarizer.git cd llama-text-summarizer ```
```bash pip install -r requirements.txt ```
```bash uvicorn backend.main:app --reload ```
```bash streamlit run frontend/app.py ```
``` llama-text-summarizer/ ├── backend/ │ └── main.py # FastAPI app ├── frontend/ │ └── app.py # Streamlit UI ├── requirements.txt └── README.md ```
- Add support for file uploads (PDF/DOCX summarization).
- Add adjustable summary length and tone controls.
- Deploy as a Docker container for easier setup.
- Add multi-language summarization support.
Contributions are welcome! If you'd like to contribute, please open an issue or submit a pull request.
Made with ❤️ by Neha Maurya
📧 mauryaneha2006@gmail.com |
🔗 LinkedIn