tykiww commited on
Commit
6ca76c1
1 Parent(s): 02fc014

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -42,8 +42,9 @@ class update_visibility:
42
  class get_datasets:
43
 
44
  def predefined_dataset(dataset_name):
45
- dataset = load_dataset(dataset_name, split = "train") #dataset_name
46
- return dataset, 'Successfully loaded dataset'
 
47
 
48
  def uploaded_dataset(file):
49
  global dataset # bad practice, I know... But just bear with me. Will later update to state dict.
@@ -54,8 +55,7 @@ class get_datasets:
54
  with open(file,'r') as file:
55
  for line in file:
56
  dataset.append(json.loads(line.strip()))
57
- print(dataset[0]['query'])
58
- return "File retrieved"
59
  except FileNotFoundError:
60
  return "File not found. Please upload the file again."
61
 
@@ -122,10 +122,6 @@ def main():
122
  dataset_predefined = gr.Textbox(label="Hugging Face Hub Training Dataset",
123
  value='yahma/alpaca-cleaned',
124
  visible=True)
125
-
126
- #dataset_uploaded_load = gr.File(label="Upload Dataset",
127
- # file_types=[".csv",".jsonl", ".txt"],
128
- # visible=False)
129
 
130
  dataset_predefined_load = gr.Button("Upload Dataset (.csv, .jsonl, or .txt)")
131
 
@@ -133,7 +129,6 @@ def main():
133
  file_types=[".csv",".jsonl", ".txt"],
134
  visible=False)
135
  data_snippet = gr.Markdown()
136
-
137
 
138
  dataset_choice.change(update_visibility.textbox_vis,
139
  dataset_choice,
 
42
  class get_datasets:
43
 
44
  def predefined_dataset(dataset_name):
45
+ global dataset # bad practice, I know... But just bear with me. Will later update to state dict.
46
+ dataset = load_dataset(dataset_name, split = "train")
47
+ return 'Successfully loaded dataset'
48
 
49
  def uploaded_dataset(file):
50
  global dataset # bad practice, I know... But just bear with me. Will later update to state dict.
 
55
  with open(file,'r') as file:
56
  for line in file:
57
  dataset.append(json.loads(line.strip()))
58
+ return "File retrieved."
 
59
  except FileNotFoundError:
60
  return "File not found. Please upload the file again."
61
 
 
122
  dataset_predefined = gr.Textbox(label="Hugging Face Hub Training Dataset",
123
  value='yahma/alpaca-cleaned',
124
  visible=True)
 
 
 
 
125
 
126
  dataset_predefined_load = gr.Button("Upload Dataset (.csv, .jsonl, or .txt)")
127
 
 
129
  file_types=[".csv",".jsonl", ".txt"],
130
  visible=False)
131
  data_snippet = gr.Markdown()
 
132
 
133
  dataset_choice.change(update_visibility.textbox_vis,
134
  dataset_choice,