lewtun HF staff commited on
Commit
3f9b5a9
1 Parent(s): b50cacf

Fix timestamps

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -62,7 +62,11 @@ def format_submissions(submissions):
62
  if "_XXX_" in submission_name:
63
  submission_name = submission_name.replace("_XXX_", " ")
64
  submission_data["Submission Name"].append(submission_name)
65
- timestamp = pd.to_datetime(int(timestamp))
 
 
 
 
66
  submission_data["Submission Date"].append(datetime.date(timestamp).strftime("%b %d, %Y"))
67
 
68
  for task in card_data["results"]:
 
62
  if "_XXX_" in submission_name:
63
  submission_name = submission_name.replace("_XXX_", " ")
64
  submission_data["Submission Name"].append(submission_name)
65
+ # Handle mismatch in epoch microseconds vs epoch seconds in new AutoTrain API
66
+ if len(timestamp) > 10:
67
+ timestamp = pd.to_datetime(int(timestamp))
68
+ else:
69
+ timestamp = pd.to_datetime(int(timestamp), unit="s")
70
  submission_data["Submission Date"].append(datetime.date(timestamp).strftime("%b %d, %Y"))
71
 
72
  for task in card_data["results"]: