2025-07-08 11:27:40 +01:00
# Streamlit
2025-05-01 21:34:02 +08:00
[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.
It can be quickly integrated with vLLM as a backend API server, enabling powerful LLM inference via API calls.
## Prerequisites
2025-09-15 12:50:36 +08:00
Set up the vLLM environment by installing all required packages:
2025-05-01 21:34:02 +08:00
2025-06-23 18:59:09 +01:00
```bash
2025-09-15 12:50:36 +08:00
pip install vllm streamlit openai
2025-05-01 21:34:02 +08:00
```
2025-09-15 12:50:36 +08:00
## Deploy
2025-05-01 21:34:02 +08:00
2025-09-15 12:50:36 +08:00
1. Start the vLLM server with a supported chat completion model, e.g.
2025-05-01 21:34:02 +08:00
2025-09-15 12:50:36 +08:00
```bash
vllm serve Qwen/Qwen1.5-0.5B-Chat
```
2025-05-01 21:34:02 +08:00
2025-09-15 12:50:36 +08:00
1. Use the script: <gh-file:examples/online_serving/streamlit_openai_chatbot_webserver.py>
2025-05-01 21:34:02 +08:00
2025-09-15 12:50:36 +08:00
1. Start the streamlit web UI and start to chat:
2025-05-01 21:34:02 +08:00
2025-09-15 12:50:36 +08:00
```bash
2025-05-25 16:40:31 +08:00
streamlit run streamlit_openai_chatbot_webserver.py
2025-05-01 21:34:02 +08:00
2025-09-15 12:50:36 +08:00
# or specify the VLLM_API_BASE or VLLM_API_KEY
VLLM_API_BASE="http://vllm-server-host:vllm-server-port/v1" \
streamlit run streamlit_openai_chatbot_webserver.py
# start with debug mode to view more details
streamlit run streamlit_openai_chatbot_webserver.py --logger.level=debug
```
2025-05-01 21:34:02 +08:00
2025-09-15 12:50:36 +08:00
