davanstrien HF staff commited on
Commit
e8dfa3e
1 Parent(s): a4421c2

chore: Improve display name formatting in get_display_name function

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -53,7 +53,12 @@ def navigate_dataset(dataset_ids, index, direction):
53
 
54
  def get_display_name(collection_id):
55
  # Strip out the extra ID part of the name
56
- return re.sub(r"-[a-f0-9]{32}$", "", collection_id)
 
 
 
 
 
57
 
58
 
59
  try:
 
53
 
54
  def get_display_name(collection_id):
55
  # Strip out the extra ID part of the name
56
+ parts = collection_id.split("/")
57
+ if len(parts) == 2:
58
+ owner, name = parts
59
+ name = re.sub(r"-[a-f0-9]{32}$", "", name)
60
+ return f"{owner}/{name}"
61
+ return collection_id # Return original if not in expected format
62
 
63
 
64
  try: