Update app.py
Browse files552 unmodified lines55355455555655755855918 unmodified lines5785795805805815825835845855815825835 unmodified lines5895905915925935945955965975985996006013 unmodified lines605606607606607608609610611612613614608609610552 unmodified lines return excel_path
# Gradio interface# Gradio interfacewith gr.Blocks() as demo: gr.Markdown("# Chat with your PDF documents and News")18 unmodified lines web_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 lines news_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 "", history 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]) def fetch_news(query, temperature, top_p, repetition_penalty, news_source): return process_news(query, temperature, top_p, repetition_penalty, news_source)
3 unmodified lines outputs=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 "", history 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]) 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)app.py+8-15