跳到內容

Streamlit

Streamlit 讓你在幾分鐘內(而不是幾周)將 Python 指令碼轉換為互動式 Web 應用程式。構建儀表板、生成報告或建立聊天應用。

它可以作為後端 API 伺服器快速與 vLLM 整合,透過 API 呼叫實現強大的 LLM 推理。

先決條件

  • 設定 vLLM 環境

部署

  • 啟動支援聊天完成模型的 vLLM 伺服器,例如
vllm serve qwen/Qwen1.5-0.5B-Chat
  • 安裝 Streamlit 和 OpenAI
pip install streamlit openai
streamlit run streamlit_openai_chatbot_webserver.py

# 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