Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ import os
|
|
| 9 |
import sys
|
| 10 |
import threading
|
| 11 |
import time
|
|
|
|
| 12 |
from typing import Optional, Tuple
|
| 13 |
|
| 14 |
import gradio as gr
|
|
@@ -24,9 +25,11 @@ ENABLE_VLLM = os.getenv("ENABLE_VLLM", "true").lower() in ("true", "1", "yes")
|
|
| 24 |
if ENABLE_VLLM:
|
| 25 |
try:
|
| 26 |
from vllm import LLM, SamplingParams
|
| 27 |
-
except ImportError:
|
| 28 |
print("[WARNING] 无法导入 vllm,自动切换到界面预览模式")
|
| 29 |
-
print("[
|
|
|
|
|
|
|
| 30 |
ENABLE_VLLM = False
|
| 31 |
LLM = None
|
| 32 |
SamplingParams = None
|
|
@@ -264,7 +267,8 @@ with gr.Blocks(title="Step Audio 2 Chat", theme=gr.themes.Soft()) as demo:
|
|
| 264 |
chatbot = gr.Chatbot(
|
| 265 |
label="聊天历史",
|
| 266 |
height=400,
|
| 267 |
-
show_copy_button=True
|
|
|
|
| 268 |
)
|
| 269 |
|
| 270 |
user_text = gr.Textbox(
|
|
@@ -399,4 +403,3 @@ if __name__ == "__main__":
|
|
| 399 |
server_port=args.port,
|
| 400 |
share=False
|
| 401 |
)
|
| 402 |
-
|
|
|
|
| 9 |
import sys
|
| 10 |
import threading
|
| 11 |
import time
|
| 12 |
+
import traceback
|
| 13 |
from typing import Optional, Tuple
|
| 14 |
|
| 15 |
import gradio as gr
|
|
|
|
| 25 |
if ENABLE_VLLM:
|
| 26 |
try:
|
| 27 |
from vllm import LLM, SamplingParams
|
| 28 |
+
except ImportError as err:
|
| 29 |
print("[WARNING] 无法导入 vllm,自动切换到界面预览模式")
|
| 30 |
+
print(f"[DETAIL] ImportError: {err}")
|
| 31 |
+
traceback.print_exc()
|
| 32 |
+
print("[INFO] 如需使用 vLLM,请确认容器环境已正确安装并可导入 vllm")
|
| 33 |
ENABLE_VLLM = False
|
| 34 |
LLM = None
|
| 35 |
SamplingParams = None
|
|
|
|
| 267 |
chatbot = gr.Chatbot(
|
| 268 |
label="聊天历史",
|
| 269 |
height=400,
|
| 270 |
+
show_copy_button=True,
|
| 271 |
+
type="messages"
|
| 272 |
)
|
| 273 |
|
| 274 |
user_text = gr.Textbox(
|
|
|
|
| 403 |
server_port=args.port,
|
| 404 |
share=False
|
| 405 |
)
|
|
|