Update app.py
Browse files552 unmodified lines55355455555655755818 unmodified lines5775785795805815825835845855865875885 unmodified lines5945955965975985993 unmodified lines603604605606607608609610611612613614615616617552 unmodified linesreturn excel_path# Gradio interfacewith gr.Blocks() as demo:gr.Markdown("# Chat with your PDF documents and News")18 unmodified linesweb_search_checkbox = gr.Checkbox(label="Enable Web Search", value=False)google_news_rss_checkbox = gr.Checkbox(label="Google News RSS", value=False)with gr.Row():news_query_input = gr.Textbox(label="Enter news query")fetch_news_button = gr.Button("Fetch News")news_fetch_output = gr.Textbox(label="News Fetch Status")with gr.Row():news_source_dropdown = gr.Dropdown(choices=["Google News RSS", "Golomt Bank"],5 unmodified linesnews_fetch_output = gr.Textbox(label="News Fetch Status")def fetch_news(query, temperature, top_p, repetition_penalty, news_source):return process_news(query, temperature, top_p, repetition_penalty, news_source)3 unmodified linesoutputs=news_fetch_output)def chat(question, history, temperature, top_p, repetition_penalty, web_search, google_news_rss):answer = ask_question(question, temperature, top_p, repetition_penalty, web_search, google_news_rss)history.append((question, answer))return "", historysubmit_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])fetch_news_button.click(process_google_news_rss, inputs=[news_query_input, temperature_slider, top_p_slider, repetition_penalty_slider], outputs=news_fetch_output)extract_button = gr.Button("Extract Database to Excel")excel_output = gr.File(label="Download Excel File")extract_button.click(extract_db_to_excel, inputs=[], outputs=excel_output)552 unmodified lines55355455555655755855918 unmodified lines5785795805815825835 unmodified lines5895905915925935945955965975985996006013 unmodified lines605606607608609610552 unmodified linesreturn excel_path# Gradio interface# Gradio interfacewith gr.Blocks() as demo:gr.Markdown("# Chat with your PDF documents and News")18 unmodified linesweb_search_checkbox = gr.Checkbox(label="Enable Web Search", value=False)google_news_rss_checkbox = gr.Checkbox(label="Google News RSS", value=False)with gr.Row():news_source_dropdown = gr.Dropdown(choices=["Google News RSS", "Golomt Bank"],5 unmodified linesnews_fetch_output = gr.Textbox(label="News Fetch Status")def chat(question, history, temperature, top_p, repetition_penalty, web_search, google_news_rss):answer = ask_question(question, temperature, top_p, repetition_penalty, web_search, google_news_rss)history.append((question, answer))return "", historysubmit_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])def fetch_news(query, temperature, top_p, repetition_penalty, news_source):return process_news(query, temperature, top_p, repetition_penalty, news_source)3 unmodified linesoutputs=news_fetch_output)extract_button = gr.Button("Extract Database to Excel")excel_output = gr.File(label="Download Excel File")extract_button.click(extract_db_to_excel, inputs=[], outputs=excel_output)
app.py+8-15