Zenith Wang commited on
Commit
1003bfe
·
1 Parent(s): db1f5a1

修复Gradio兼容性问题:指定chatbot type参数,简化代码结构

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -121,7 +121,7 @@ def stream_response(
121
  yield chat_history, ""
122
 
123
 
124
- with gr.Blocks(title="StepFun - Step3 Multimodal Chat", theme=gr.themes.Soft()) as demo:
125
  gr.Markdown("""
126
  # StepFun Step-3 多模态对话(Hugging Face Space)
127
  - 支持上传图片 + 文本提问,后端接口兼容 OpenAI Chat Completions。
@@ -149,7 +149,7 @@ with gr.Blocks(title="StepFun - Step3 Multimodal Chat", theme=gr.themes.Soft())
149
  lines=2,
150
  )
151
 
152
- chatbot = gr.Chatbot(height=420, show_label=False)
153
 
154
  with gr.Row():
155
  image = gr.Image(label="上传图片(可选)", type="pil")
@@ -175,4 +175,4 @@ with gr.Blocks(title="StepFun - Step3 Multimodal Chat", theme=gr.themes.Soft())
175
 
176
  if __name__ == "__main__":
177
  # 本地调试:python app.py
178
- demo.queue().launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 7860)))
 
121
  yield chat_history, ""
122
 
123
 
124
+ with gr.Blocks(title="StepFun - Step3 Multimodal Chat") as demo:
125
  gr.Markdown("""
126
  # StepFun Step-3 多模态对话(Hugging Face Space)
127
  - 支持上传图片 + 文本提问,后端接口兼容 OpenAI Chat Completions。
 
149
  lines=2,
150
  )
151
 
152
+ chatbot = gr.Chatbot(height=420, show_label=False, type="tuples")
153
 
154
  with gr.Row():
155
  image = gr.Image(label="上传图片(可选)", type="pil")
 
175
 
176
  if __name__ == "__main__":
177
  # 本地调试:python app.py
178
+ demo.launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 7860)), share=False)