Update app.py
Browse files
app.py
CHANGED
@@ -33,25 +33,21 @@ with gr.Blocks() as demo:
|
|
33 |
# Prompt Input
|
34 |
name_input = gr.Textbox(label="Your Name")
|
35 |
# Dataset choice
|
36 |
-
dataset_choice = gr.Radio(label="Choose Dataset", choices=["Predefined Dataset", "Upload Your Own"], value="
|
37 |
-
dataset_predefined = gr.Dropdown(label="Predefined Dataset", choices=['1', '2', '3'], value='1', visible=
|
38 |
-
dataset_upload = gr.
|
39 |
|
40 |
-
# Function to
|
41 |
-
def
|
42 |
if choice == "Predefined Dataset":
|
43 |
dataset_predefined.visible = True
|
44 |
dataset_upload.visible = False
|
45 |
elif choice == "Upload Your Own":
|
46 |
dataset_predefined.visible = False
|
47 |
dataset_upload.visible = True
|
48 |
-
return dataset_predefined, dataset_upload # Return both components
|
49 |
|
50 |
-
# Initial
|
51 |
-
|
52 |
-
|
53 |
-
# Update visibility based on user choice
|
54 |
-
dataset_choice.change(update_dataset_visibility, inputs=[dataset_choice], outputs=[dataset_predefined, dataset_upload])
|
55 |
|
56 |
##### Model Outputs #####
|
57 |
|
@@ -64,9 +60,12 @@ with gr.Blocks() as demo:
|
|
64 |
tune_btn = gr.Button("Start Fine Tuning")
|
65 |
# Execute button
|
66 |
tune_btn.click(fn=greet,
|
67 |
-
inputs=[model_name, prompt_template, name_input,
|
68 |
outputs=output)
|
69 |
|
|
|
|
|
|
|
70 |
##################################### Launch #######################################
|
71 |
|
72 |
if __name__ == "__main__":
|
|
|
33 |
# Prompt Input
|
34 |
name_input = gr.Textbox(label="Your Name")
|
35 |
# Dataset choice
|
36 |
+
dataset_choice = gr.Radio(label="Choose Dataset", choices=["Predefined Dataset", "Upload Your Own"], value="Predefined Dataset")
|
37 |
+
dataset_predefined = gr.Dropdown(label="Predefined Dataset", choices=['1', '2', '3'], value='1', visible=True)
|
38 |
+
dataset_upload = gr.Upload(label="Upload Dataset", accept=".csv,.txt", visible=False)
|
39 |
|
40 |
+
# Function to toggle visibility based on user choice
|
41 |
+
def toggle_dataset_visibility(choice):
|
42 |
if choice == "Predefined Dataset":
|
43 |
dataset_predefined.visible = True
|
44 |
dataset_upload.visible = False
|
45 |
elif choice == "Upload Your Own":
|
46 |
dataset_predefined.visible = False
|
47 |
dataset_upload.visible = True
|
|
|
48 |
|
49 |
+
# Initial visibility setup based on default choice
|
50 |
+
toggle_dataset_visibility(dataset_choice.value)
|
|
|
|
|
|
|
51 |
|
52 |
##### Model Outputs #####
|
53 |
|
|
|
60 |
tune_btn = gr.Button("Start Fine Tuning")
|
61 |
# Execute button
|
62 |
tune_btn.click(fn=greet,
|
63 |
+
inputs=[model_name, prompt_template, name_input, dataset_upload],
|
64 |
outputs=output)
|
65 |
|
66 |
+
# Update visibility based on user choice
|
67 |
+
dataset_choice.change(toggle_dataset_visibility, inputs=[dataset_choice], outputs=[])
|
68 |
+
|
69 |
##################################### Launch #######################################
|
70 |
|
71 |
if __name__ == "__main__":
|