Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ import os
|
|
| 8 |
|
| 9 |
|
| 10 |
############ logging, and committing translation ##############
|
| 11 |
-
from huggingface_hub import HfApi
|
| 12 |
import time
|
| 13 |
from datetime import datetime
|
| 14 |
from langdetect import detect
|
|
@@ -76,14 +76,30 @@ def commit_logs_to_hf(manual=False):
|
|
| 76 |
return f"Committed logs to {repo_path}"
|
| 77 |
|
| 78 |
def update_dataset_card_info():
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
repo_id=HF_DATASET,
|
| 81 |
repo_type="dataset",
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
| 86 |
)
|
|
|
|
| 87 |
|
| 88 |
|
| 89 |
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
############ logging, and committing translation ##############
|
| 11 |
+
from huggingface_hub import HfApi, CommitOperationAdd
|
| 12 |
import time
|
| 13 |
from datetime import datetime
|
| 14 |
from langdetect import detect
|
|
|
|
| 76 |
return f"Committed logs to {repo_path}"
|
| 77 |
|
| 78 |
def update_dataset_card_info():
|
| 79 |
+
api = HfApi()
|
| 80 |
+
|
| 81 |
+
# Build the README.md content dynamically
|
| 82 |
+
readme = f"""
|
| 83 |
+
# Zomi Translator Logs
|
| 84 |
+
|
| 85 |
+
**License:** MIT
|
| 86 |
+
**Languages:** Zomi, English
|
| 87 |
+
|
| 88 |
+
Daily logs of Zomi ↔ English translations.
|
| 89 |
+
"""
|
| 90 |
+
|
| 91 |
+
api.create_commit(
|
| 92 |
repo_id=HF_DATASET,
|
| 93 |
repo_type="dataset",
|
| 94 |
+
commit_message="Update dataset card metadata",
|
| 95 |
+
operations=[
|
| 96 |
+
CommitOperationAdd(
|
| 97 |
+
path_in_repo="README.md",
|
| 98 |
+
path_or_fileobj=readme.encode("utf-8")
|
| 99 |
+
)
|
| 100 |
+
]
|
| 101 |
)
|
| 102 |
+
|
| 103 |
|
| 104 |
|
| 105 |
|