Shreyas094 commited on
Commit
7b3e103
·
verified ·
1 Parent(s): 03d36e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -504,19 +504,19 @@ with gr.Blocks() as demo:
504
  repetition_penalty_slider = gr.Slider(label="Repetition Penalty", minimum=1.0, maximum=2.0, value=1.0, step=0.1)
505
  web_search_checkbox = gr.Checkbox(label="Enable Web Search", value=False)
506
 
507
- def chat(question, history, temperature, top_p, repetition_penalty, web_search):
508
- answer = ask_question(question, temperature, top_p, repetition_penalty, web_search)
509
-
510
- if "news" in question.lower():
511
- # Split the answer into individual news items
512
- news_items = answer.split("---")
513
- for item in news_items:
514
- if item.strip():
515
- history.append((question, item.strip()))
516
- else:
517
- history.append((question, answer))
518
-
519
- return "", history
520
 
521
  submit_button.click(chat, inputs=[question_input, chatbot, temperature_slider, top_p_slider, repetition_penalty_slider, web_search_checkbox], outputs=[question_input, chatbot])
522
 
 
504
  repetition_penalty_slider = gr.Slider(label="Repetition Penalty", minimum=1.0, maximum=2.0, value=1.0, step=0.1)
505
  web_search_checkbox = gr.Checkbox(label="Enable Web Search", value=False)
506
 
507
+ def chat(question, history, temperature, top_p, repetition_penalty, web_search):
508
+ answer = ask_question(question, temperature, top_p, repetition_penalty, web_search)
509
+
510
+ if "news" in question.lower():
511
+ # Split the answer into individual news items
512
+ news_items = answer.split("---")
513
+ for item in news_items:
514
+ if item.strip():
515
+ history.append((question, item.strip()))
516
+ else:
517
+ history.append((question, answer))
518
+
519
+ return "", history
520
 
521
  submit_button.click(chat, inputs=[question_input, chatbot, temperature_slider, top_p_slider, repetition_penalty_slider, web_search_checkbox], outputs=[question_input, chatbot])
522