Shreyas094 commited on
Commit
01447cf
1 Parent(s): 773f976

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -15
app.py CHANGED
@@ -553,6 +553,7 @@ def export_memory_db_to_excel():
553
 
554
  return excel_path
555
 
 
556
  # Gradio interface
557
  with gr.Blocks() as demo:
558
  gr.Markdown("# Chat with your PDF documents and News")
@@ -577,12 +578,6 @@ with gr.Blocks() as demo:
577
  web_search_checkbox = gr.Checkbox(label="Enable Web Search", value=False)
578
  google_news_rss_checkbox = gr.Checkbox(label="Google News RSS", value=False)
579
 
580
- with gr.Row():
581
- news_query_input = gr.Textbox(label="Enter news query")
582
- fetch_news_button = gr.Button("Fetch News")
583
-
584
- news_fetch_output = gr.Textbox(label="News Fetch Status")
585
-
586
  with gr.Row():
587
  news_source_dropdown = gr.Dropdown(
588
  choices=["Google News RSS", "Golomt Bank"],
@@ -594,6 +589,13 @@ with gr.Blocks() as demo:
594
 
595
  news_fetch_output = gr.Textbox(label="News Fetch Status")
596
 
 
 
 
 
 
 
 
597
  def fetch_news(query, temperature, top_p, repetition_penalty, news_source):
598
  return process_news(query, temperature, top_p, repetition_penalty, news_source)
599
 
@@ -603,15 +605,6 @@ with gr.Blocks() as demo:
603
  outputs=news_fetch_output
604
  )
605
 
606
- def chat(question, history, temperature, top_p, repetition_penalty, web_search, google_news_rss):
607
- answer = ask_question(question, temperature, top_p, repetition_penalty, web_search, google_news_rss)
608
- history.append((question, answer))
609
- return "", history
610
-
611
- submit_button.click(chat, inputs=[question_input, chatbot, temperature_slider, top_p_slider, repetition_penalty_slider, web_search_checkbox, google_news_rss_checkbox], outputs=[question_input, chatbot])
612
-
613
- fetch_news_button.click(process_google_news_rss, inputs=[news_query_input, temperature_slider, top_p_slider, repetition_penalty_slider], outputs=news_fetch_output)
614
-
615
  extract_button = gr.Button("Extract Database to Excel")
616
  excel_output = gr.File(label="Download Excel File")
617
  extract_button.click(extract_db_to_excel, inputs=[], outputs=excel_output)
 
553
 
554
  return excel_path
555
 
556
+ # Gradio interface
557
  # Gradio interface
558
  with gr.Blocks() as demo:
559
  gr.Markdown("# Chat with your PDF documents and News")
 
578
  web_search_checkbox = gr.Checkbox(label="Enable Web Search", value=False)
579
  google_news_rss_checkbox = gr.Checkbox(label="Google News RSS", value=False)
580
 
 
 
 
 
 
 
581
  with gr.Row():
582
  news_source_dropdown = gr.Dropdown(
583
  choices=["Google News RSS", "Golomt Bank"],
 
589
 
590
  news_fetch_output = gr.Textbox(label="News Fetch Status")
591
 
592
+ def chat(question, history, temperature, top_p, repetition_penalty, web_search, google_news_rss):
593
+ answer = ask_question(question, temperature, top_p, repetition_penalty, web_search, google_news_rss)
594
+ history.append((question, answer))
595
+ return "", history
596
+
597
+ submit_button.click(chat, inputs=[question_input, chatbot, temperature_slider, top_p_slider, repetition_penalty_slider, web_search_checkbox, google_news_rss_checkbox], outputs=[question_input, chatbot])
598
+
599
  def fetch_news(query, temperature, top_p, repetition_penalty, news_source):
600
  return process_news(query, temperature, top_p, repetition_penalty, news_source)
601
 
 
605
  outputs=news_fetch_output
606
  )
607
 
 
 
 
 
 
 
 
 
 
608
  extract_button = gr.Button("Extract Database to Excel")
609
  excel_output = gr.File(label="Download Excel File")
610
  extract_button.click(extract_db_to_excel, inputs=[], outputs=excel_output)