Spaces:
No application file
No application file
File size: 790 Bytes
c54bb81 1ce200c c54bb81 f312132 c54bb81 f312132 c54bb81 f312132 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
"""Template for custom function or Pydantic model."""
import csv
from pathlib import Path
def record_interestingness(title: str, uninteresting: bool) -> str:
"""Label the interestingness of the entry.
Args:
title (str): The title of the entry to label.
uninteresting (bool): Whether the entry is uninteresting.
"""
# Create result.csv if it doesn't exist
result_file = Path("result.csv")
file_exists = result_file.exists()
with open(result_file, "a", newline="") as f:
writer = csv.writer(f)
# Write header if file is new
if not file_exists:
writer.writerow(["title", "uninteresting"])
# Write results
writer.writerow([title, int(uninteresting)])
return "Entry labeled successfully."
|