Update app.py
Browse files
app.py
CHANGED
@@ -37,10 +37,10 @@ def _get_args():
|
|
37 |
args = parser.parse_args()
|
38 |
return args
|
39 |
|
40 |
-
def handle_image_submission(_chatbot, task_history, file
|
41 |
if file is None:
|
42 |
return _chatbot, task_history
|
43 |
-
file_path = save_image(file, uploaded_file_dir)
|
44 |
history_item = ((file_path,), None)
|
45 |
_chatbot.append(history_item)
|
46 |
task_history.append(history_item)
|
@@ -143,15 +143,15 @@ def _launch_demo(args, model, tokenizer):
|
|
143 |
if 'image' in query[0]:
|
144 |
image = tokenizer.draw_bbox_on_latest_picture(response)
|
145 |
if image is not None:
|
146 |
-
image_path =
|
147 |
_chatbot[-1] = (chat_query, (image_path,))
|
148 |
else:
|
149 |
_chatbot[-1] = (chat_query, "No image to display.")
|
150 |
else:
|
151 |
_chatbot[-1] = (chat_query, response)
|
152 |
-
|
153 |
return _chatbot
|
154 |
|
|
|
155 |
def save_image(image, uploaded_file_dir):
|
156 |
if image is None:
|
157 |
return None
|
|
|
37 |
args = parser.parse_args()
|
38 |
return args
|
39 |
|
40 |
+
def handle_image_submission(_chatbot, task_history, file):
|
41 |
if file is None:
|
42 |
return _chatbot, task_history
|
43 |
+
file_path = save_image(file, uploaded_file_dir) # Renamed for clarity
|
44 |
history_item = ((file_path,), None)
|
45 |
_chatbot.append(history_item)
|
46 |
task_history.append(history_item)
|
|
|
143 |
if 'image' in query[0]:
|
144 |
image = tokenizer.draw_bbox_on_latest_picture(response)
|
145 |
if image is not None:
|
146 |
+
image_path = save_generated_image(image, uploaded_file_dir) # Renamed for clarity
|
147 |
_chatbot[-1] = (chat_query, (image_path,))
|
148 |
else:
|
149 |
_chatbot[-1] = (chat_query, "No image to display.")
|
150 |
else:
|
151 |
_chatbot[-1] = (chat_query, response)
|
|
|
152 |
return _chatbot
|
153 |
|
154 |
+
|
155 |
def save_image(image, uploaded_file_dir):
|
156 |
if image is None:
|
157 |
return None
|