Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -262,16 +262,16 @@ with gr.Blocks() as demo:
|
|
262 |
print(f"Generating response for: {message}")
|
263 |
if use_web_search:
|
264 |
print("Using web search")
|
265 |
-
main_content, sources = get_response_with_search(message, model, num_calls=num_calls, temperature=temperature
|
266 |
formatted_response = f"{main_content}\n\nSources:\n{sources}"
|
267 |
else:
|
268 |
print("Using PDF search")
|
269 |
-
response = get_response_from_pdf(message, model, num_calls=num_calls, temperature=temperature
|
270 |
formatted_response = response
|
271 |
|
272 |
print(f"Generated response: {formatted_response[:100]}...")
|
273 |
|
274 |
-
if not stop_clicked:
|
275 |
print("Appending to history")
|
276 |
history.append((message, formatted_response))
|
277 |
else:
|
@@ -287,11 +287,11 @@ with gr.Blocks() as demo:
|
|
287 |
def on_submit(message, history, use_web_search, model, temperature, num_calls, is_generating, stop_clicked):
|
288 |
print(f"Submit button clicked with message: {message}")
|
289 |
_, new_history, new_is_generating, new_stop_clicked = protected_generate_response(
|
290 |
-
message, history, use_web_search, model, temperature, num_calls, is_generating,
|
291 |
)
|
292 |
print(f"New history has {len(new_history)} items")
|
293 |
return "", new_history, new_is_generating, new_stop_clicked
|
294 |
-
|
295 |
submit_btn.click(
|
296 |
on_submit,
|
297 |
inputs=[msg, chatbot, use_web_search, model_dropdown, temperature_slider, num_calls_slider, is_generating, stop_clicked],
|
|
|
262 |
print(f"Generating response for: {message}")
|
263 |
if use_web_search:
|
264 |
print("Using web search")
|
265 |
+
main_content, sources = get_response_with_search(message, model, num_calls=num_calls, temperature=temperature)
|
266 |
formatted_response = f"{main_content}\n\nSources:\n{sources}"
|
267 |
else:
|
268 |
print("Using PDF search")
|
269 |
+
response = get_response_from_pdf(message, model, num_calls=num_calls, temperature=temperature)
|
270 |
formatted_response = response
|
271 |
|
272 |
print(f"Generated response: {formatted_response[:100]}...")
|
273 |
|
274 |
+
if not stop_clicked():
|
275 |
print("Appending to history")
|
276 |
history.append((message, formatted_response))
|
277 |
else:
|
|
|
287 |
def on_submit(message, history, use_web_search, model, temperature, num_calls, is_generating, stop_clicked):
|
288 |
print(f"Submit button clicked with message: {message}")
|
289 |
_, new_history, new_is_generating, new_stop_clicked = protected_generate_response(
|
290 |
+
message, history, use_web_search, model, temperature, num_calls, is_generating, stop_clicked
|
291 |
)
|
292 |
print(f"New history has {len(new_history)} items")
|
293 |
return "", new_history, new_is_generating, new_stop_clicked
|
294 |
+
|
295 |
submit_btn.click(
|
296 |
on_submit,
|
297 |
inputs=[msg, chatbot, use_web_search, model_dropdown, temperature_slider, num_calls_slider, is_generating, stop_clicked],
|