gr_reload_button.py 629 B

1234567891011121314151617181920212223242526
  1. import gradio as gr
  2. from tts_webui.history_tab.open_folder import open_folder
  3. def gr_icon_button(value="refresh", **kwargs):
  4. return gr.Button(
  5. value=value,
  6. elem_classes="btn-sm material-symbols-outlined",
  7. size="sm",
  8. **kwargs,
  9. )
  10. def gr_reload_button(**kwargs):
  11. return gr_icon_button(value="refresh", **kwargs)
  12. def gr_open_button(**kwargs):
  13. return gr_icon_button(value="folder_open", **kwargs)
  14. def gr_open_button_simple(dirname="", api_name=None, **kwargs):
  15. return gr_open_button(**kwargs).click(
  16. fn=lambda: open_folder(dirname),
  17. api_name=api_name,
  18. )