tykiww commited on
Commit
5a49926
1 Parent(s): dfd7ad6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -49,12 +49,14 @@ class get_datasets:
49
  dataset = []
50
  if file is None:
51
  return "File not found. Please upload the file again."
52
- with open(file,'r') as file:
53
- for line in file:
54
- dataset.append(json.loads(line.strip()))
55
- print(dataset[0]['query'])
56
- return dataset
57
-
 
 
58
 
59
 
60
 
 
49
  dataset = []
50
  if file is None:
51
  return "File not found. Please upload the file again."
52
+ try:
53
+ with open(file,'r') as file:
54
+ for line in file:
55
+ dataset.append(json.loads(line.strip()))
56
+ print(dataset[0]['query'])
57
+ return dataset
58
+ except FileNotFoundError:
59
+ return "File not found. Please upload the file again."
60
 
61
 
62