| 1 | # Streamlit |
| 2 | |
| 3 | [Streamlit](https://github.com/streamlit/streamlit) lets you transform Python scripts into interactive web apps in minutes, instead of weeks. Build dashboards, generate reports, or create chat apps. |
| 4 | |
| 5 | It can be quickly integrated with vLLM as a backend API server, enabling powerful LLM inference via API calls. |
| 6 | |
| 7 | ## Prerequisites |
| 8 | |
| 9 | Set up the vLLM environment by installing all required packages: |
| 10 | |
| 11 | ```bash |
| 12 | pip install vllm streamlit openai |
| 13 | ``` |
| 14 | |
| 15 | ## Deploy |
| 16 | |
| 17 | 1. Start the vLLM server with a supported chat completion model, e.g. |
| 18 | |
| 19 | ```bash |
| 20 | vllm serve Qwen/Qwen1.5-0.5B-Chat |
| 21 | ``` |
| 22 | |
| 23 | 1. Use the script: [examples/applications/chatbot/streamlit_openai_chatbot_webserver.py](../../../examples/applications/chatbot/streamlit_openai_chatbot_webserver.py) |
| 24 | |
| 25 | 1. Start the streamlit web UI and start to chat: |
| 26 | |
| 27 | ```bash |
| 28 | streamlit run streamlit_openai_chatbot_webserver.py |
| 29 | |
| 30 | # or specify the VLLM_API_BASE or VLLM_API_KEY |
| 31 | VLLM_API_BASE="http://vllm-server-host:vllm-server-port/v1" \ |
| 32 | streamlit run streamlit_openai_chatbot_webserver.py |
| 33 | |
| 34 | # start with debug mode to view more details |
| 35 | streamlit run streamlit_openai_chatbot_webserver.py --logger.level=debug |
| 36 | ``` |
| 37 | |
| 38 |  |