Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 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 |
|