|
1 | 1 | # Chat Assistant with Streamlit and FastAPI
|
2 | 2 |
|
3 |
| -This project is a chat application with a web interface developed with Streamlit and a backend developed with FastAPI. The chat queries a TinyLlama model hosted on Hugging Face to respond to users' questions. The entire solution is containerized and can be deployed with both Docker Compose and Kubernetes. |
| 3 | +This project is a chat application with a web interface developed using Streamlit and a backend developed with FastAPI. The backend integrates and loads the TinyLlama model directly to handle chat queries and generate responses to users' questions. The entire solution is containerized, allowing for deployment with both Docker Compose and Kubernetes. |
4 | 4 |
|
5 | 5 | ## Features
|
6 | 6 |
|
7 |
| -- Chat interface with a TinyLlama model hosted on Hugging Face to respond to user queries in natural language format with a conversational tone and context. View the [TinyLlama model](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0). |
| 7 | +- Chat Interface with TinyLlama Model: The chat interface uses a TinyLlama model integrated within the backend to respond to user queries in natural language format with a conversational tone and context. The model is not hosted on Hugging Face but is instead downloaded and loaded directly in the backend for real-time response generation. View the [TinyLlama model](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0). |
8 | 8 | - Web interface developed with Streamlit. The user can interact with the chatbot and view the responses in real-time. View the [Streamlit documentation](https://docs.streamlit.io/).
|
9 | 9 | - Backend API developed with FastAPI. The API handles the chatbot logic and interacts with the TinyLlama model to generate responses. View the [FastAPI documentation](https://fastapi.tiangolo.com/).
|
10 | 10 | - Containerized images with Docker
|
@@ -36,6 +36,42 @@ In this project, you can find the following workflows (only available with each
|
36 | 36 | ```bash
|
37 | 37 | docker pull ghcr.io/adribaeza/llm-tinyllama-frontend:latest
|
38 | 38 | ```
|
| 39 | +# Architecture solution |
| 40 | + |
| 41 | +The architecture of the chat assistant application is designed to be modular and scalable. The application is divided into two main components: the frontend and the backend. |
| 42 | + |
| 43 | +Frontend (Streamlit): |
| 44 | + |
| 45 | +Developed with Streamlit, it provides the user interface for interacting with the chatbot. |
| 46 | +Users can send chat messages and receive responses through the frontend interface. |
| 47 | +Backend (FastAPI): |
| 48 | + |
| 49 | +Developed with FastAPI, it handles the chatbot logic and interactions with the TinyLlama model. |
| 50 | +The TinyLlama model, a conversational language model, is downloaded and loaded within the backend to generate real-time responses. |
| 51 | +The backend exposes an API that the frontend uses to send chat messages and receive responses from the chatbot. |
| 52 | +Both components, frontend and backend, are containerized with Docker and can be deployed using Docker Compose or Kubernetes. This separation allows for independent scaling and deployment of each part of the application. |
| 53 | + |
| 54 | +The frontend communicates with the backend via HTTP POST requests, sending chat messages to the backend and receiving responses generated by the TinyLlama model. The TinyLlama model is not hosted externally but is directly integrated and loaded within the backend to provide real-time responses. |
| 55 | + |
| 56 | +The application is designed to be user-friendly and interactive, allowing users to chat with the chatbot and view responses immediately. It can be deployed on local machines or in the cloud using Docker Compose or Kubernetes. |
| 57 | + |
| 58 | +``` |
| 59 | ++--------------------------------------+ |
| 60 | +| Docker | |
| 61 | +| | |
| 62 | +| +-------------+ +-------------+ | |
| 63 | +| | Frontend | | Backend | | |
| 64 | +| | (Streamlit) | <--->| (FastAPI) | | |
| 65 | +| +-------------+ HTTP| +---------+ | | |
| 66 | +| | | TinyLlama | | |
| 67 | +| | | (Modelo) | | |
| 68 | +| | +---------+ | | |
| 69 | +| +----------------------------------+ | |
| 70 | +| Docker Compose / Kubernetes | |
| 71 | ++--------------------------------------+ |
| 72 | +``` |
| 73 | +
|
| 74 | + |
39 | 75 |
|
40 | 76 | # Project Structure
|
41 | 77 |
|
@@ -124,6 +160,7 @@ The root directory contains configuration files and documentation for the overal
|
124 | 160 | - **pytest.ini**: Configuration file for pytest. Example: exclude directories from testing, set verbosity, etc.
|
125 | 161 | - **README.md**: Main documentation file for the project.
|
126 | 162 |
|
| 163 | +
|
127 | 164 | ## Getting Started
|
128 | 165 |
|
129 | 166 | ### Prerequisites
|
|
0 commit comments