danieldeng commited on
Commit
0bfc462
·
verified ·
1 Parent(s): 58592cc

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +7 -1
Gradio_UI.py CHANGED
@@ -162,9 +162,15 @@ def stream_to_gradio(
162
  content=f"**Final answer:**\n{final_answer.to_string()}\n",
163
  )
164
  elif isinstance(final_answer, AgentImage):
 
 
 
 
 
 
165
  yield gr.ChatMessage(
166
  role="assistant",
167
- content={"path": final_answer.to_string(), "mime_type": "image/png"},
168
  )
169
  elif isinstance(final_answer, AgentAudio):
170
  yield gr.ChatMessage(
 
162
  content=f"**Final answer:**\n{final_answer.to_string()}\n",
163
  )
164
  elif isinstance(final_answer, AgentImage):
165
+ # 强制保存并获取绝对路径
166
+ image_path = final_answer.to_string()
167
+ if not os.path.exists(image_path):
168
+ # 调试用:如果路径不存在,打印出来
169
+ print(f"Warning: Image path not found: {image_path}")
170
+
171
  yield gr.ChatMessage(
172
  role="assistant",
173
+ content={"path": image_path, "mime_type": "image/png"},
174
  )
175
  elif isinstance(final_answer, AgentAudio):
176
  yield gr.ChatMessage(