unsloth / app.py
Sebastien De Greef
chore: Add Gradio interface for processing input
4af8a78
raw
history blame
1 kB
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()