Tonic commited on
Commit
81bee99
·
1 Parent(s): e78f385

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -66,7 +66,9 @@ def chat_interface(chatbot, text_query, file):
66
  if "<box>" in response:
67
  image_with_boxes = chatbot.draw_boxes(response)
68
  chatbot.clear_memory()
69
- return [("Qwen-VL_Chat", response), ("Qwen-VL_Image", image_with_boxes)]
 
 
70
  else:
71
  chatbot.clear_memory()
72
  return [("Qwen-VL_Chat", response)]
 
66
  if "<box>" in response:
67
  image_with_boxes = chatbot.draw_boxes(response)
68
  chatbot.clear_memory()
69
+ # Separate the text and image responses
70
+ text_response = re.sub(r'<ref>.*?</ref>(?:<box>.*?</box>)*(?:<quad>.*?</quad>)*', '', response).strip()
71
+ return [("Qwen-VL_Chat", text_response), ("Qwen-VL_Image", image_with_boxes)]
72
  else:
73
  chatbot.clear_memory()
74
  return [("Qwen-VL_Chat", response)]