tykiww commited on
Commit
52589e7
1 Parent(s): 94fc903

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -22
app.py CHANGED
@@ -44,25 +44,41 @@ def update_interface(dataset_input):
44
  outputs=output
45
  ).launch()
46
 
47
- # Select Model
48
- model_name = gr.Dropdown(label="Model", choices=conf['model']['choices'], value="gpt2")
49
- # Prompt template
50
- prompt_template = gr.Textbox(label="Prompt Template", value="Instruction: {0}\nOutput: {1}")
51
- # Prompt Input
52
- name_input = gr.Textbox(label="Your Name")
53
- # Dataset choice
54
- dataset_choice = gr.Radio(label="Choose Dataset", choices=["Predefined Dataset", "Upload Your Own"], value="Predefined Dataset")
55
-
56
- # Initial interface setup
57
- initial_choice = dataset_choice.value
58
- initial_interface = build_interface(initial_choice)
59
-
60
- # Output textbox
61
- output = gr.Textbox(label="Output")
62
-
63
- # Setup button
64
- tune_btn = gr.Button("Start Fine Tuning")
65
- tune_btn.click(on_choice_change, inputs=[dataset_choice])
66
-
67
- # Launch the initial interface
68
- update_interface(initial_interface)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  outputs=output
45
  ).launch()
46
 
47
+ ##################################### Gradio Blocks #######################################
48
+ with gr.Blocks() as demo:
49
+
50
+ ##### Title Block #####
51
+ gr.Markdown("# Instruction Tuning with Unsloth")
52
+
53
+ ##### Model Inputs #####
54
+
55
+ # Select Model
56
+ model_name = gr.Dropdown(label="Model", choices=conf['model']['choices'], value="gpt2")
57
+ # Prompt template
58
+ prompt_template = gr.Textbox(label="Prompt Template", value="Instruction: {0}\nOutput: {1}")
59
+ # Prompt Input
60
+ name_input = gr.Textbox(label="Your Name")
61
+ # Dataset choice
62
+ dataset_choice = gr.Radio(label="Choose Dataset", choices=["Predefined Dataset", "Upload Your Own"], value="Predefined Dataset")
63
+
64
+ # Initial interface setup
65
+ initial_choice = dataset_choice.value
66
+ initial_interface = build_interface(initial_choice)
67
+
68
+ # Output textbox
69
+ output = gr.Textbox(label="Output")
70
+
71
+ # Setup button
72
+ tune_btn = gr.Button("Start Fine Tuning")
73
+ tune_btn.click(on_choice_change, inputs=[dataset_choice])
74
+
75
+ # Launch the initial interface
76
+ update_interface(initial_interface)
77
+
78
+ # Update visibility based on user choice
79
+ dataset_choice.change(on_choice_change, inputs=[dataset_choice])
80
+
81
+ ##################################### Launch #######################################
82
+
83
+ if __name__ == "__main__":
84
+ demo.launch()