File size: 757 Bytes
bdf3e70
 
bd3b81a
 
bdf3e70
5d52f32
 
1e282db
 
5d52f32
bd3b81a
 
 
 
 
 
 
 
 
0bb2563
bd3b81a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr

def greet(model_name, prompt_template, name):
    return f"Hello {name}!! Using model: {model_name} with template: {prompt_template}"

model_choices = ["gpt2", "bert-base-uncased", "llama3-8b"]

with gr.Blocks() as demo:
    gr.Markdown("# Instruction Tuning with Unsloth")
    model_name = gr.Dropdown(label="Model", choices=model_choices, value="gpt2")
    prompt_template = gr.Textbox(label="Prompt Template", value="Instruction: {0}\nOutput: {1}")
    name_input = gr.Textbox(label="Your Name")
    
    greet_btn = gr.Button("Greet")
    output = gr.Textbox(label="Output")
    
    greet_btn.click(fn=greet, 
                    inputs=[model_name, prompt_template, name_input], 
                    outputs=output)

demo.launch()