Spaces:
Sleeping
Sleeping
| # Utility functions for UI components | |
| import gradio as gr | |
| def update_input_visibility(choice): | |
| """ | |
| Returns updates to the visibility of input components based on the selected input method. | |
| Args: | |
| choice (str): The selected input method ("Upload File", "Enter URL", "Enter Base64"). | |
| Returns: | |
| tuple: A tuple containing Gradio Update objects for the visibility of the input components. | |
| """ | |
| if choice == "Upload File": | |
| return ( | |
| gr.update(visible=True), | |
| gr.update(visible=False), | |
| gr.update(visible=False), | |
| ) | |
| elif choice == "Enter URL": | |
| return ( | |
| gr.update(visible=False), | |
| gr.update(visible=True), | |
| gr.update(visible=False), | |
| ) | |
| elif choice == "Enter Base64": | |
| return ( | |
| gr.update(visible=False), | |
| gr.update(visible=False), | |
| gr.update(visible=True), | |
| ) | |
| else: # Default or unexpected | |
| return ( | |
| gr.update(visible=True), | |
| gr.update(visible=False), | |
| gr.update(visible=False), | |
| ) | |