File size: 1,120 Bytes
e70400c
 
 
2d3e7bb
b9dd0a0
e70400c
b9dd0a0
e70400c
 
 
 
 
b9dd0a0
e70400c
 
 
b9dd0a0
 
 
e70400c
 
 
b9dd0a0
 
 
e70400c
 
 
b9dd0a0
 
 
e70400c
2d3e7bb
 
b9dd0a0
 
 
2d3e7bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 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),
        )