Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -44,25 +44,41 @@ def update_interface(dataset_input):
|
|
44 |
outputs=output
|
45 |
).launch()
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
#
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|