soyleyicicem commited on
Commit
fda10d4
·
verified ·
1 Parent(s): d462e1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -395,16 +395,17 @@ with gr.Blocks() as demo:
395
  # return chat(question, manual, history, liked_state.value)
396
  def gradio_chat(question, manual, history):
397
  save_last_interaction("N/A") # Save previous interaction before starting a new one
398
-
399
- # Soruyu hemen history'ye ekle ve güncellenmiş history'yi döndür
400
  history.append((question, ""))
401
  yield "", history
402
-
403
- # Chat fonksiyonunu çağır ve cevabı al
404
- _, updated_history = chat(question, manual, history, liked_state.value)
405
-
406
- # Cevabı içeren güncellenmiş history'yi döndür
407
- yield "", updated_history
 
 
 
408
 
409
  textbox.submit(gradio_chat, [textbox, manual, chatbot], [textbox, chatbot])
410
  chatbot.like(handle_like, None, None)
 
395
  # return chat(question, manual, history, liked_state.value)
396
  def gradio_chat(question, manual, history):
397
  save_last_interaction("N/A") # Save previous interaction before starting a new one
 
 
398
  history.append((question, ""))
399
  yield "", history
400
+
401
+ chat_generator = chat(question, manual, history, liked_state.value)
402
+ final_response = ""
403
+ final_history = history
404
+ for partial_response, updated_history in chat_generator:
405
+ final_response += partial_response
406
+ final_history = updated_history
407
+ yield "", final_history
408
+ return "", final_history
409
 
410
  textbox.submit(gradio_chat, [textbox, manual, chatbot], [textbox, chatbot])
411
  chatbot.like(handle_like, None, None)