Aivis commited on
Commit
3491363
·
verified ·
1 Parent(s): 6338f4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -214,16 +214,16 @@ with gr.Blocks() as demo:
214
  content_dict = get_topic_content(topic_code)
215
  return gr.update(choices=list(content_dict.keys()), visible=True), content_dict, topic_code
216
 
217
- def update_reports(topic_content_name:str, topic_name:str='', content_dict:dict = None)-> Tuple[Dict[str, str], str, Any]:
218
  """
219
  Updates the UI dropdown menu with available report titles for a selected topic content,
220
  and returns the titles dictionary and the corresponding content code.
221
 
222
  Args:
223
  topic_content_name (str): The name of the selected topic content (e.g., "Darba samaksa (algas)"). Topic content names you can get from `update_topic_content` (`content_dict` object).
 
224
  topic_name (str): The name of the selected topic. Possible topic names: 'Darbs', 'Iedzīvotāji', 'Informācijas tehnoloģijas', 'Izglītība, kultūra un zinātne', 'Nozares',\
225
- 'Sociālā aizsardzība un veselība', 'Tirdzniecība un pakalpojumi', 'Uzņēmējdarbība', 'Valsts un ekonomika', 'Vide'.
226
- content_dict (dict): A dictionary mapping topic content names to their corresponding content codes. Obtained from `update_topic_content` (2nd returned object: `content_dict`).
227
 
228
  Returns:
229
  tuple:
@@ -304,7 +304,7 @@ with gr.Blocks() as demo:
304
  topic_content_code_state = gr.State()
305
 
306
  topic_dropdown.change(fn=update_topic_content, inputs=topic_dropdown, outputs=[topic_content_dropdown, topic_content_state, topic_code_state])
307
- topic_content_dropdown.change(fn=update_reports, inputs=[topic_content_dropdown, '', topic_content_state], #, topic_code_state],
308
  outputs=[titles_state, topic_content_code_state, report_dropdown])
309
  report_dropdown.change(fn=update_topic_params_and_link, inputs=[report_dropdown, titles_state], #, topic_code_state, topic_content_code_state],
310
  outputs=[topic_params_box, link_output, kwargs_box])
 
214
  content_dict = get_topic_content(topic_code)
215
  return gr.update(choices=list(content_dict.keys()), visible=True), content_dict, topic_code
216
 
217
+ def update_reports(topic_content_name:str, content_dict:dict = None, topic_name:str='')-> Tuple[Dict[str, str], str, Any]:
218
  """
219
  Updates the UI dropdown menu with available report titles for a selected topic content,
220
  and returns the titles dictionary and the corresponding content code.
221
 
222
  Args:
223
  topic_content_name (str): The name of the selected topic content (e.g., "Darba samaksa (algas)"). Topic content names you can get from `update_topic_content` (`content_dict` object).
224
+ content_dict (dict): A dictionary mapping topic content names to their corresponding content codes. Obtained from `update_topic_content` (2nd returned object: `content_dict`).
225
  topic_name (str): The name of the selected topic. Possible topic names: 'Darbs', 'Iedzīvotāji', 'Informācijas tehnoloģijas', 'Izglītība, kultūra un zinātne', 'Nozares',\
226
+ 'Sociālā aizsardzība un veselība', 'Tirdzniecība un pakalpojumi', 'Uzņēmējdarbība', 'Valsts un ekonomika', 'Vide'.
 
227
 
228
  Returns:
229
  tuple:
 
304
  topic_content_code_state = gr.State()
305
 
306
  topic_dropdown.change(fn=update_topic_content, inputs=topic_dropdown, outputs=[topic_content_dropdown, topic_content_state, topic_code_state])
307
+ topic_content_dropdown.change(fn=update_reports, inputs=[topic_content_dropdown, topic_content_state], #, topic_code_state],
308
  outputs=[titles_state, topic_content_code_state, report_dropdown])
309
  report_dropdown.change(fn=update_topic_params_and_link, inputs=[report_dropdown, titles_state], #, topic_code_state, topic_content_code_state],
310
  outputs=[topic_params_box, link_output, kwargs_box])