File size: 1,001 Bytes
c78d27d
 
4af8a78
 
 
c78d27d
4af8a78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr

def process_input(model_name, checkbox1, checkbox2, text1, text2):
    result = f"Model: {model_name}\nCheckbox 1: {checkbox1}\nCheckbox 2: {checkbox2}\nText Field 1: {text1}\nText Field 2: {text2}"
    return result

# Dropdown options
model_options = ["Model A", "Model B", "Model C"]

# Create the Gradio interface
with gr.Blocks() as demo:
    gr.Markdown("## Gradio Interface Example")

    # Dropdown for model_name
    model_name = gr.Dropdown(choices=model_options, label="Select Model")

    # Checkboxes
    checkbox1 = gr.Checkbox(label="Checkbox 1")
    checkbox2 = gr.Checkbox(label="Checkbox 2")

    # Text fields
    text1 = gr.Textbox(label="Text Field 1")
    text2 = gr.Textbox(label="Text Field 2")

    # Output
    output = gr.Textbox(label="Output")

    # Button to submit and process the input
    submit_btn = gr.Button("Submit")
    submit_btn.click(process_input, inputs=[model_name, checkbox1, checkbox2, text1, text2], outputs=output)

demo.launch()