tykiww commited on
Commit
a52308c
1 Parent(s): 3c7cad4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -21,6 +21,12 @@ def textbox_visibility(radio):
21
  else:
22
  return gr.Dropdown(visible=bool(0))
23
 
 
 
 
 
 
 
24
 
25
  def upload_visibility(radio):
26
  value = radio
@@ -29,6 +35,9 @@ def upload_visibility(radio):
29
  else:
30
  return gr.UploadButton(visible=bool(0))
31
 
 
 
 
32
  #from datasets import load_dataset
33
 
34
  def get_predefined_dataset(dataset_name):
@@ -98,15 +107,18 @@ def main():
98
  dataset_choice = gr.Radio(label="Choose Dataset",
99
  choices=["Hugging Face Hub Dataset", "Upload Your Own"],
100
  value="Hugging Face Hub Dataset")
 
101
  dataset_predefined = gr.Textbox(label="Hugging Face Hub Dataset",
102
  value='yahma/alpaca-cleaned',
103
  visible=True)
104
- dataset_predefined_load = gr.Button("Upload Dataset")
105
  dataset_uploaded_load = gr.UploadButton(label="Upload Dataset (csv, jsonl, or txt)",
106
  file_types=[".csv",".jsonl", ".txt"],
107
  visible=False)
 
108
  data_field = gr.Textbox(label="Dataset Training Field",
109
  value=conf['model']['general']["dataset_text_field"])
 
110
  data_snippet = gr.Markdown()
111
  dataset_choice.change(textbox_visibility,
112
  dataset_choice,
@@ -114,6 +126,9 @@ def main():
114
  dataset_choice.change(upload_visibility,
115
  dataset_choice,
116
  dataset_uploaded_load)
 
 
 
117
 
118
  # Dataset button
119
  dataset_predefined_load.click(fn=get_predefined_dataset,
 
21
  else:
22
  return gr.Dropdown(visible=bool(0))
23
 
24
+ def textbox_button_visibility(radio)
25
+ value = radio
26
+ if value == "Hugging Face Hub Dataset":
27
+ return gr.Button(visible=bool(1))
28
+ else:
29
+ return gr.Button(visible=bool(0))
30
 
31
  def upload_visibility(radio):
32
  value = radio
 
35
  else:
36
  return gr.UploadButton(visible=bool(0))
37
 
38
+
39
+
40
+
41
  #from datasets import load_dataset
42
 
43
  def get_predefined_dataset(dataset_name):
 
107
  dataset_choice = gr.Radio(label="Choose Dataset",
108
  choices=["Hugging Face Hub Dataset", "Upload Your Own"],
109
  value="Hugging Face Hub Dataset")
110
+
111
  dataset_predefined = gr.Textbox(label="Hugging Face Hub Dataset",
112
  value='yahma/alpaca-cleaned',
113
  visible=True)
114
+ dataset_predefined_load = gr.Button(label="Upload Dataset")
115
  dataset_uploaded_load = gr.UploadButton(label="Upload Dataset (csv, jsonl, or txt)",
116
  file_types=[".csv",".jsonl", ".txt"],
117
  visible=False)
118
+
119
  data_field = gr.Textbox(label="Dataset Training Field",
120
  value=conf['model']['general']["dataset_text_field"])
121
+
122
  data_snippet = gr.Markdown()
123
  dataset_choice.change(textbox_visibility,
124
  dataset_choice,
 
126
  dataset_choice.change(upload_visibility,
127
  dataset_choice,
128
  dataset_uploaded_load)
129
+ dataset_choice.change(textbox_button_visibility,
130
+ dataset_choice,
131
+ dataset_predefined)
132
 
133
  # Dataset button
134
  dataset_predefined_load.click(fn=get_predefined_dataset,