Spaces:
Sleeping
Sleeping
Nash-pAnDiTa
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -24,8 +24,9 @@ def update_transcriptions(df, dataset, token,dataset_link):
|
|
24 |
Update the transcriptions in the dataset and push it back to the Hugging Face Hub.
|
25 |
"""
|
26 |
# Convert DataFrame back to Dataset
|
|
|
27 |
updated_dataset = Dataset.from_pandas(df)
|
28 |
-
|
29 |
# print(updated_dataset)
|
30 |
# print(dataset)
|
31 |
|
@@ -74,6 +75,15 @@ def main():
|
|
74 |
original_df.loc[original_df["index"] == row["index"], "transcription"] = row["transcription"]
|
75 |
|
76 |
return "update Successful"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
def submit_changes(df, token,dataset_link):
|
79 |
"""
|
|
|
24 |
Update the transcriptions in the dataset and push it back to the Hugging Face Hub.
|
25 |
"""
|
26 |
# Convert DataFrame back to Dataset
|
27 |
+
df = delete_empty_rows(df)
|
28 |
updated_dataset = Dataset.from_pandas(df)
|
29 |
+
|
30 |
# print(updated_dataset)
|
31 |
# print(dataset)
|
32 |
|
|
|
75 |
original_df.loc[original_df["index"] == row["index"], "transcription"] = row["transcription"]
|
76 |
|
77 |
return "update Successful"
|
78 |
+
|
79 |
+
def delete_empty_rows(updated_df):
|
80 |
+
"""
|
81 |
+
Delete rows marked for removal from the dataset.
|
82 |
+
"""
|
83 |
+
# Remove rows where transcription is empty or manually marked
|
84 |
+
updated_df = updated_df.dropna(subset=["transcription"])
|
85 |
+
updated_df = updated_df[updated_df["transcription"].str.strip() != ""]
|
86 |
+
return updated_df
|
87 |
|
88 |
def submit_changes(df, token,dataset_link):
|
89 |
"""
|