AvocadoMuffin commited on
Commit
b076ea3
·
verified ·
1 Parent(s): e39bba0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -14
app.py CHANGED
@@ -214,7 +214,7 @@ def save_feedback(query, response, feedback, comment=""):
214
 
215
  # Create new data from current feedback
216
  new_data = pd.DataFrame([[query, response, feedback, comment]], columns=["Query", "Response_Generated", "Feedback", "Comment"])
217
-
218
  # Check if the feedback file exists and load it, otherwise create an empty dataframe
219
  if os.path.exists(feedback_file):
220
  # If file exists, load the existing data
@@ -233,20 +233,11 @@ def save_feedback(query, response, feedback, comment=""):
233
 
234
  # Ensure the repo exists or create one
235
  repo_name = "AvocadoMuffin/Chat_Feedback_Data"
236
-
237
  try:
238
- # Check if the repo exists using HfApi
239
- hf_api = HfApi()
240
- hf_api.dataset_info(repo_name) # Try to fetch the dataset info
241
- print("Dataset repo already exists!")
242
- except Exception:
243
- # Repo does not exist, create it
244
- try:
245
- create_repo(repo_name, repo_type="dataset", exist_ok=True) # Creates the repo if it doesn't exist
246
- print("Dataset repo created!")
247
- except Exception as e:
248
- print(f"Error creating the repo: {e}")
249
-
250
  # Push the dataset to Hugging Face Hub
251
  dataset.push_to_hub(repo_name)
252
 
 
214
 
215
  # Create new data from current feedback
216
  new_data = pd.DataFrame([[query, response, feedback, comment]], columns=["Query", "Response_Generated", "Feedback", "Comment"])
217
+
218
  # Check if the feedback file exists and load it, otherwise create an empty dataframe
219
  if os.path.exists(feedback_file):
220
  # If file exists, load the existing data
 
233
 
234
  # Ensure the repo exists or create one
235
  repo_name = "AvocadoMuffin/Chat_Feedback_Data"
 
236
  try:
237
+ create_repo(repo_name, repo_type="dataset", exist_ok=True) # Creates the repo if it doesn't exist
238
+ except Exception as e:
239
+ print(f"Error creating the repo: {e}")
240
+
 
 
 
 
 
 
 
 
241
  # Push the dataset to Hugging Face Hub
242
  dataset.push_to_hub(repo_name)
243