cmagganas commited on
Commit
a23421d
1 Parent(s): 58e17dd

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app/app.py +4 -2
  2. app/openai_chat_completion.py +9 -1
app/app.py CHANGED
@@ -49,5 +49,7 @@ if st.button("Run Data Cleaning API"):
49
  file_name='cleaned_df.csv',
50
  mime='text/csv',
51
  )
52
-
53
-
 
 
 
49
  file_name='cleaned_df.csv',
50
  mime='text/csv',
51
  )
52
+
53
+ # if both text_input and csv_file are empty, display error message
54
+ else:
55
+ st.write("Please enter text or upload a CSV file.")
app/openai_chat_completion.py CHANGED
@@ -42,7 +42,14 @@ class OpenAIChatCompletions:
42
 
43
 
44
  # function to use test data to predict completions
45
- def predict_jsonl(self, path_or_buf='../data/cookies_test.jsonl', n_samples=None, n_shot=None):
 
 
 
 
 
 
 
46
  jsonObj = pd.read_json(path_or_buf=path_or_buf, lines=True)
47
  if n_samples is not None:
48
  jsonObj = jsonObj.sample(n_samples, random_state=42)
@@ -76,5 +83,6 @@ class OpenAIChatCompletions:
76
  path_or_buf='~/data/cookies_train.jsonl',
77
  n_samples=5
78
  ):
 
79
  jsonObj = pd.read_json(path_or_buf=path_or_buf, lines=True)
80
  return jsonObj.sample(n_samples, random_state=42)
 
42
 
43
 
44
  # function to use test data to predict completions
45
+ def predict_jsonl(
46
+ self,
47
+ # path_or_buf='../data/cookies_train.jsonl',
48
+ path_or_buf='~/data/cookies_train.jsonl',
49
+ n_samples=None,
50
+ n_shot=None
51
+ ):
52
+
53
  jsonObj = pd.read_json(path_or_buf=path_or_buf, lines=True)
54
  if n_samples is not None:
55
  jsonObj = jsonObj.sample(n_samples, random_state=42)
 
83
  path_or_buf='~/data/cookies_train.jsonl',
84
  n_samples=5
85
  ):
86
+
87
  jsonObj = pd.read_json(path_or_buf=path_or_buf, lines=True)
88
  return jsonObj.sample(n_samples, random_state=42)