Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
4c8802b
1
Parent(s):
dfd1066
debug
Browse files
app.py
CHANGED
@@ -182,13 +182,15 @@ def http_bot(state):
|
|
182 |
state.messages[-1][-1] = server_error_msg
|
183 |
yield (state, state.to_gradio_chatbot_public()) + (enable_btn,) * 2
|
184 |
return
|
|
|
|
|
185 |
state.messages[-1][-1] = state.messages[-1][-1][:-1]
|
186 |
yield (state, state.to_gradio_chatbot_public()) + (disable_btn,) * 2
|
187 |
|
188 |
# Step 2: Query-conditioned Caption
|
189 |
state.append_message(state.roles[1], "# Query-conditioned Caption\n\n▌")
|
190 |
try:
|
191 |
-
for generated_text in stream_response(mllm, cap_inputs, mllm_streamer,
|
192 |
output = generated_text[len(cap_prompt):].strip()
|
193 |
state.messages[-1][-1] = "# Query-conditioned Caption\n\n" + output + "▌"
|
194 |
yield (state, state.to_gradio_chatbot_public()) + (disable_btn,) * 2
|
@@ -198,6 +200,8 @@ def http_bot(state):
|
|
198 |
state.messages[-1][-1] = server_error_msg
|
199 |
yield (state, state.to_gradio_chatbot_public()) + (enable_btn,) * 2
|
200 |
return
|
|
|
|
|
201 |
state.messages[-1][-1] = state.messages[-1][-1][:-1]
|
202 |
yield (state, state.to_gradio_chatbot_public()) + (disable_btn,) * 2
|
203 |
|
|
|
182 |
state.messages[-1][-1] = server_error_msg
|
183 |
yield (state, state.to_gradio_chatbot_public()) + (enable_btn,) * 2
|
184 |
return
|
185 |
+
tentative_answer = output
|
186 |
+
logging.info(f"Tentative Response: {tentative_answer}")
|
187 |
state.messages[-1][-1] = state.messages[-1][-1][:-1]
|
188 |
yield (state, state.to_gradio_chatbot_public()) + (disable_btn,) * 2
|
189 |
|
190 |
# Step 2: Query-conditioned Caption
|
191 |
state.append_message(state.roles[1], "# Query-conditioned Caption\n\n▌")
|
192 |
try:
|
193 |
+
for generated_text in stream_response(mllm, cap_inputs, mllm_streamer, cap_prompt, mllm_sampling):
|
194 |
output = generated_text[len(cap_prompt):].strip()
|
195 |
state.messages[-1][-1] = "# Query-conditioned Caption\n\n" + output + "▌"
|
196 |
yield (state, state.to_gradio_chatbot_public()) + (disable_btn,) * 2
|
|
|
200 |
state.messages[-1][-1] = server_error_msg
|
201 |
yield (state, state.to_gradio_chatbot_public()) + (enable_btn,) * 2
|
202 |
return
|
203 |
+
caption_text = output
|
204 |
+
logging.info(f"Query-conditioned Caption: {caption_text}")
|
205 |
state.messages[-1][-1] = state.messages[-1][-1][:-1]
|
206 |
yield (state, state.to_gradio_chatbot_public()) + (disable_btn,) * 2
|
207 |
|