streamlit.md 1.13 KB
Newer Older
1
2
3
4
---
title: Streamlit
---
[](){ #deployment-streamlit }
5
6
7
8
9
10
11
12
13
14
15
16
17

[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

- Setup vLLM environment

## Deploy

- Start the vLLM server with the supported chat completion model, e.g.

18
```bash
19
20
21
22
23
vllm serve qwen/Qwen1.5-0.5B-Chat
```

- Install streamlit and openai:

24
```bash
25
26
27
28
29
30
31
pip install streamlit openai
```

- Use the script: <gh-file:examples/online_serving/streamlit_openai_chatbot_webserver.py>

- Start the streamlit web UI and start to chat:

32
```bash
33
34
35
streamlit run streamlit_openai_chatbot_webserver.py

# or specify the VLLM_API_BASE or VLLM_API_KEY
Reid's avatar
Reid committed
36
37
VLLM_API_BASE="http://vllm-server-host:vllm-server-port/v1" \
    streamlit run streamlit_openai_chatbot_webserver.py
38
39
40
41
42

# start with debug mode to view more details
streamlit run streamlit_openai_chatbot_webserver.py --logger.level=debug
```

43
![](../../assets/deployment/streamlit-chat.png)