Update app.py
Browse files223 unmodified lines2242252262272282292302 unmodified lines23323423523623723823912 unmodified lines25225325425525625725852 unmodified lines311312313314315316317223 unmodified linescontent_dict = get_topic_content(topic_code)return gr.update(choices=list(content_dict.keys()), visible=True), content_dict, topic_codedef update_reports(topic_content_name:str, content_dict:dict)-> Tuple[Any, Dict[str, str], str]:"""Updates the UI dropdown menu with available report titles for a selected topic content,and returns the titles dictionary and the corresponding content code.2 unmodified linestopic_content_name (str): The name of the selected topic content (e.g., "Darba samaksa (algas)").Topic content you can get from `update_topic_content` (`content_dict` object).content_dict (dict): A dictionary mapping topic content names to their corresponding content codes.Typically obtained from `update_topic_content` (`content_dict` object).Returns:tuple:12 unmodified lines"""topic_content_code = content_dict[topic_content_name]titles_dict = get_titles(topic_content_code)return gr.update(choices=list(titles_dict.keys()), visible=True), titles_dict, topic_content_codedef update_topic_params_and_link(report_title:str, titles_dict:str)-> Tuple[str, Any, Any]:"""52 unmodified linestopic_dropdown.change(fn=update_topic_content, inputs=topic_dropdown, outputs=[topic_content_dropdown, topic_content_state, topic_code_state])topic_content_dropdown.change(fn=update_reports, inputs=[topic_content_dropdown, topic_content_state], #, topic_code_state],outputs=[report_dropdown, titles_state, topic_content_code_state])report_dropdown.change(fn=update_topic_params_and_link, inputs=[report_dropdown, titles_state], #, topic_code_state, topic_content_code_state],outputs=[topic_params_box, link_output, kwargs_box])223 unmodified lines2242252262272282292302 unmodified lines23323423523623723823912 unmodified lines25225325425525625725852 unmodified lines311312313314315316317223 unmodified linescontent_dict = get_topic_content(topic_code)return gr.update(choices=list(content_dict.keys()), visible=True), content_dict, topic_codedef update_reports(topic_content_name:str, content_dict:dict)-> Tuple[Dict[str, str], str, Any]:"""Updates the UI dropdown menu with available report titles for a selected topic content,and returns the titles dictionary and the corresponding content code.2 unmodified linestopic_content_name (str): The name of the selected topic content (e.g., "Darba samaksa (algas)").Topic content you can get from `update_topic_content` (`content_dict` object).content_dict (dict): A dictionary mapping topic content names to their corresponding content codes.Obtained from `update_topic_content` (2nd returned object: `content_dict`).Returns:tuple:12 unmodified lines"""topic_content_code = content_dict[topic_content_name]titles_dict = get_titles(topic_content_code)return titles_dict, topic_content_code, gr.update(choices=list(titles_dict.keys()), visible=True)def update_topic_params_and_link(report_title:str, titles_dict:str)-> Tuple[str, Any, Any]:"""52 unmodified linestopic_dropdown.change(fn=update_topic_content, inputs=topic_dropdown, outputs=[topic_content_dropdown, topic_content_state, topic_code_state])topic_content_dropdown.change(fn=update_reports, inputs=[topic_content_dropdown, topic_content_state], #, topic_code_state],outputs=[titles_state, topic_content_code_state, report_dropdown])report_dropdown.change(fn=update_topic_params_and_link, inputs=[report_dropdown, titles_state], #, topic_code_state, topic_content_code_state],outputs=[topic_params_box, link_output, kwargs_box])
app.py+4-4