yonigozlan HF Staff commited on
Commit
2a0740b
·
1 Parent(s): 2225a22

push changes

Browse files
Files changed (1) hide show
  1. app.py +56 -60
app.py CHANGED
@@ -487,6 +487,13 @@ class TransformersTimelineParser:
487
  with open(file_path, "r", encoding="utf-8") as f:
488
  content = f.read()
489
 
 
 
 
 
 
 
 
490
  # Focus on the end of the sentence - the Transformers addition date is what matters most
491
  pattern = (
492
  r"\*This model was released on (.+?) and added to Hugging Face Transformers on (\d{4}-\d{2}-\d{2})\.\*"
@@ -494,7 +501,6 @@ class TransformersTimelineParser:
494
  match = re.search(pattern, content)
495
 
496
  if match:
497
- model_name = os.path.basename(file_path).replace(".md", "")
498
  release_date = match.group(1).strip()
499
  transformers_date = match.group(2)
500
 
@@ -514,6 +520,12 @@ class TransformersTimelineParser:
514
  except ValueError:
515
  # Keep the original value even if it's not a valid date
516
  pass
 
 
 
 
 
 
517
 
518
  # Get modality information
519
  modality = self.get_model_modality(model_name)
@@ -1115,9 +1127,9 @@ def create_timeline_template():
1115
 
1116
  .modality-checkbox input[type="checkbox"] {
1117
  appearance: none;
1118
- width: 14px;
1119
- height: 14px;
1120
- border: 2px solid currentColor;
1121
  border-radius: 4px;
1122
  position: relative;
1123
  margin: 0;
@@ -1127,28 +1139,22 @@ def create_timeline_template():
1127
  }
1128
 
1129
  .modality-checkbox input[type="checkbox"]:checked {
1130
- background: currentColor;
1131
- border-color: currentColor;
1132
  }
1133
 
1134
  .modality-checkbox input[type="checkbox"]:checked::after {
1135
  content: '✓';
1136
  position: absolute;
1137
- top: 1px;
1138
- left: 3px;
 
1139
  color: white;
1140
- font-size: 12px;
1141
  font-weight: bold;
1142
  line-height: 1;
1143
  }
1144
 
1145
- .modality-color-dot {
1146
- width: 8px;
1147
- height: 8px;
1148
- border-radius: 50%;
1149
- flex-shrink: 0;
1150
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
1151
- }
1152
 
1153
  .modality-checkbox label {
1154
  cursor: pointer;
@@ -1163,12 +1169,13 @@ def create_timeline_template():
1163
  align-items: center;
1164
  gap: 0.3rem;
1165
  padding: 0.3rem 0.5rem;
1166
- border-radius: 8px;
1167
- font-size: 0.65rem;
1168
- cursor: pointer;
1169
  background: rgba(255, 255, 255, 0.9);
1170
  border: 1px solid rgba(0, 0, 0, 0.1);
 
 
1171
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
 
 
1172
  position: relative;
1173
  overflow: hidden;
1174
  }
@@ -1183,7 +1190,6 @@ def create_timeline_template():
1183
  background: currentColor;
1184
  opacity: 0;
1185
  transition: opacity 0.3s ease;
1186
- z-index: -1;
1187
  }
1188
 
1189
  .task-checkbox:hover {
@@ -1197,19 +1203,20 @@ def create_timeline_template():
1197
  }
1198
 
1199
  .task-checkbox.checked {
 
1200
  border-color: currentColor;
1201
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
1202
  }
1203
 
1204
  .task-checkbox.checked::before {
1205
- opacity: 0.1;
1206
  }
1207
 
1208
  .task-checkbox input[type="checkbox"] {
1209
  appearance: none;
1210
- width: 14px;
1211
- height: 14px;
1212
- border: 2px solid currentColor;
1213
  border-radius: 4px;
1214
  background: white;
1215
  cursor: pointer;
@@ -1218,8 +1225,8 @@ def create_timeline_template():
1218
  }
1219
 
1220
  .task-checkbox input[type="checkbox"]:checked {
1221
- background: currentColor;
1222
- border-color: currentColor;
1223
  }
1224
 
1225
  .task-checkbox input[type="checkbox"]:checked::after {
@@ -1229,16 +1236,11 @@ def create_timeline_template():
1229
  left: 50%;
1230
  transform: translate(-50%, -50%);
1231
  color: white;
1232
- font-size: 12px;
1233
  font-weight: bold;
 
1234
  }
1235
 
1236
- .task-color-dot {
1237
- width: 8px;
1238
- height: 8px;
1239
- border-radius: 50%;
1240
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
1241
- }
1242
 
1243
  .task-checkbox label {
1244
  cursor: pointer;
@@ -1249,7 +1251,7 @@ def create_timeline_template():
1249
 
1250
  .modality-checkbox input[type="checkbox"]:not(:checked) {
1251
  background: white;
1252
- border-color: currentColor;
1253
  }
1254
 
1255
  .btn {
@@ -1954,8 +1956,8 @@ def create_timeline_template():
1954
  </div>
1955
 
1956
  <div class="controls-wrapper">
1957
- <div class="controls" id="filtersPanel">
1958
- <button id="toggleFilters" class="controls-toggle" type="button" aria-label="Toggle filters" onclick="toggleFilters()">▾</button>
1959
  <div class="input-group modality-group">
1960
  <label>Modalities</label>
1961
  <div class="modality-filters" id="modalityFilters">
@@ -1963,10 +1965,10 @@ def create_timeline_template():
1963
  </div>
1964
  <div class="modality-buttons">
1965
  <button class="btn btn-primary btn-small" onclick="checkAllModalities()">
1966
- Check All
1967
  </button>
1968
  <button class="btn btn-secondary btn-small" onclick="clearAllModalities()">
1969
- Clear All
1970
  </button>
1971
  </div>
1972
  </div>
@@ -1977,10 +1979,10 @@ def create_timeline_template():
1977
  </div>
1978
  <div class="task-buttons">
1979
  <button class="btn btn-primary btn-small" onclick="checkAllTasks()">
1980
- Check All
1981
  </button>
1982
  <button class="btn btn-secondary btn-small" onclick="clearAllTasks()">
1983
- Clear All
1984
  </button>
1985
  </div>
1986
  </div>
@@ -2771,10 +2773,12 @@ def create_timeline_template():
2771
  const checkboxContainer = document.createElement('div');
2772
  checkboxContainer.className = 'task-checkbox';
2773
  checkboxContainer.style.color = task.color;
 
2774
 
2775
  const checkbox = document.createElement('input');
2776
  checkbox.type = 'checkbox';
2777
  checkbox.value = task.key;
 
2778
  checkbox.checked = false; // Start with all tasks unchecked
2779
  checkbox.addEventListener('click', (e) => {
2780
  e.stopPropagation();
@@ -2787,27 +2791,23 @@ def create_timeline_template():
2787
  loadTimeline();
2788
  });
2789
 
2790
- const colorDot = document.createElement('div');
2791
- colorDot.className = 'task-color-dot';
2792
- colorDot.style.backgroundColor = task.color;
2793
-
2794
  const label = document.createElement('label');
 
2795
  label.textContent = task.name;
2796
- label.addEventListener('click', (e) => {
2797
- e.preventDefault();
2798
- checkbox.checked = !checkbox.checked;
2799
- if (checkbox.checked) {
2800
- checkboxContainer.classList.add('checked');
2801
- } else {
2802
- checkboxContainer.classList.remove('checked');
 
2803
  }
2804
- // Auto-refresh timeline
 
2805
  loadTimeline();
2806
  });
2807
 
2808
- checkboxContainer.appendChild(checkbox);
2809
- checkboxContainer.appendChild(colorDot);
2810
- checkboxContainer.appendChild(label);
2811
  taskFilters.appendChild(checkboxContainer);
2812
  });
2813
 
@@ -2900,6 +2900,7 @@ def create_timeline_template():
2900
  const checkboxContainer = document.createElement('div');
2901
  checkboxContainer.className = 'modality-checkbox';
2902
  checkboxContainer.style.color = modality.color;
 
2903
 
2904
  const checkbox = document.createElement('input');
2905
  checkbox.type = 'checkbox';
@@ -2907,16 +2908,11 @@ def create_timeline_template():
2907
  checkbox.id = `modality-${modality.key}`;
2908
  checkbox.checked = true; // All modalities selected by default
2909
 
2910
- const colorDot = document.createElement('div');
2911
- colorDot.className = 'modality-color-dot';
2912
- colorDot.style.backgroundColor = modality.color;
2913
-
2914
  const label = document.createElement('label');
2915
  label.htmlFor = `modality-${modality.key}`;
2916
  label.textContent = modality.name;
2917
 
2918
  checkboxContainer.appendChild(checkbox);
2919
- checkboxContainer.appendChild(colorDot);
2920
  checkboxContainer.appendChild(label);
2921
 
2922
  // Add click handler with auto-refresh
 
487
  with open(file_path, "r", encoding="utf-8") as f:
488
  content = f.read()
489
 
490
+ # Extract model name from file path (always available)
491
+ model_name = os.path.basename(file_path).replace(".md", "")
492
+
493
+ # Initialize default values
494
+ release_date = None
495
+ transformers_date = None
496
+
497
  # Focus on the end of the sentence - the Transformers addition date is what matters most
498
  pattern = (
499
  r"\*This model was released on (.+?) and added to Hugging Face Transformers on (\d{4}-\d{2}-\d{2})\.\*"
 
501
  match = re.search(pattern, content)
502
 
503
  if match:
 
504
  release_date = match.group(1).strip()
505
  transformers_date = match.group(2)
506
 
 
520
  except ValueError:
521
  # Keep the original value even if it's not a valid date
522
  pass
523
+ else:
524
+ # No release date pattern found - warn and skip (ignore auto.md intentionally)
525
+ base = os.path.basename(file_path)
526
+ if base != "auto.md":
527
+ print(f"⚠️ Warning: No release/addition dates found in {file_path}; skipping.")
528
+ return None
529
 
530
  # Get modality information
531
  modality = self.get_model_modality(model_name)
 
1127
 
1128
  .modality-checkbox input[type="checkbox"] {
1129
  appearance: none;
1130
+ width: 16px;
1131
+ height: 16px;
1132
+ border: 2px solid var(--modality-color, #8B5CF6);
1133
  border-radius: 4px;
1134
  position: relative;
1135
  margin: 0;
 
1139
  }
1140
 
1141
  .modality-checkbox input[type="checkbox"]:checked {
1142
+ background: var(--modality-color, #8B5CF6);
1143
+ border-color: var(--modality-color, #8B5CF6);
1144
  }
1145
 
1146
  .modality-checkbox input[type="checkbox"]:checked::after {
1147
  content: '✓';
1148
  position: absolute;
1149
+ top: 50%;
1150
+ left: 50%;
1151
+ transform: translate(-50%, -50%);
1152
  color: white;
1153
+ font-size: 10px;
1154
  font-weight: bold;
1155
  line-height: 1;
1156
  }
1157
 
 
 
 
 
 
 
 
1158
 
1159
  .modality-checkbox label {
1160
  cursor: pointer;
 
1169
  align-items: center;
1170
  gap: 0.3rem;
1171
  padding: 0.3rem 0.5rem;
 
 
 
1172
  background: rgba(255, 255, 255, 0.9);
1173
  border: 1px solid rgba(0, 0, 0, 0.1);
1174
+ border-radius: 8px;
1175
+ cursor: pointer;
1176
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
1177
+ font-size: 0.65rem;
1178
+ font-weight: 500;
1179
  position: relative;
1180
  overflow: hidden;
1181
  }
 
1190
  background: currentColor;
1191
  opacity: 0;
1192
  transition: opacity 0.3s ease;
 
1193
  }
1194
 
1195
  .task-checkbox:hover {
 
1203
  }
1204
 
1205
  .task-checkbox.checked {
1206
+ background: rgba(255, 255, 255, 0.95);
1207
  border-color: currentColor;
1208
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
1209
  }
1210
 
1211
  .task-checkbox.checked::before {
1212
+ opacity: 0.08;
1213
  }
1214
 
1215
  .task-checkbox input[type="checkbox"] {
1216
  appearance: none;
1217
+ width: 16px;
1218
+ height: 16px;
1219
+ border: 2px solid var(--task-color, #6366f1);
1220
  border-radius: 4px;
1221
  background: white;
1222
  cursor: pointer;
 
1225
  }
1226
 
1227
  .task-checkbox input[type="checkbox"]:checked {
1228
+ background: var(--task-color, #6366f1);
1229
+ border-color: var(--task-color, #6366f1);
1230
  }
1231
 
1232
  .task-checkbox input[type="checkbox"]:checked::after {
 
1236
  left: 50%;
1237
  transform: translate(-50%, -50%);
1238
  color: white;
1239
+ font-size: 10px;
1240
  font-weight: bold;
1241
+ line-height: 1;
1242
  }
1243
 
 
 
 
 
 
 
1244
 
1245
  .task-checkbox label {
1246
  cursor: pointer;
 
1251
 
1252
  .modality-checkbox input[type="checkbox"]:not(:checked) {
1253
  background: white;
1254
+ border-color: var(--modality-color, #8B5CF6);
1255
  }
1256
 
1257
  .btn {
 
1956
  </div>
1957
 
1958
  <div class="controls-wrapper">
1959
+ <div class="controls collapsed" id="filtersPanel">
1960
+ <button id="toggleFilters" class="controls-toggle" type="button" aria-label="Toggle filters" onclick="toggleFilters()">▸</button>
1961
  <div class="input-group modality-group">
1962
  <label>Modalities</label>
1963
  <div class="modality-filters" id="modalityFilters">
 
1965
  </div>
1966
  <div class="modality-buttons">
1967
  <button class="btn btn-primary btn-small" onclick="checkAllModalities()">
1968
+ Check All
1969
  </button>
1970
  <button class="btn btn-secondary btn-small" onclick="clearAllModalities()">
1971
+ Clear All
1972
  </button>
1973
  </div>
1974
  </div>
 
1979
  </div>
1980
  <div class="task-buttons">
1981
  <button class="btn btn-primary btn-small" onclick="checkAllTasks()">
1982
+ Check All
1983
  </button>
1984
  <button class="btn btn-secondary btn-small" onclick="clearAllTasks()">
1985
+ Clear All
1986
  </button>
1987
  </div>
1988
  </div>
 
2773
  const checkboxContainer = document.createElement('div');
2774
  checkboxContainer.className = 'task-checkbox';
2775
  checkboxContainer.style.color = task.color;
2776
+ checkboxContainer.style.setProperty('--task-color', task.color);
2777
 
2778
  const checkbox = document.createElement('input');
2779
  checkbox.type = 'checkbox';
2780
  checkbox.value = task.key;
2781
+ checkbox.id = `task-${task.key}`;
2782
  checkbox.checked = false; // Start with all tasks unchecked
2783
  checkbox.addEventListener('click', (e) => {
2784
  e.stopPropagation();
 
2791
  loadTimeline();
2792
  });
2793
 
 
 
 
 
2794
  const label = document.createElement('label');
2795
+ label.htmlFor = `task-${task.key}`;
2796
  label.textContent = task.name;
2797
+
2798
+ checkboxContainer.appendChild(checkbox);
2799
+ checkboxContainer.appendChild(label);
2800
+
2801
+ // Add click handler with auto-refresh
2802
+ checkboxContainer.addEventListener('click', (e) => {
2803
+ if (e.target.type !== 'checkbox') {
2804
+ checkbox.checked = !checkbox.checked;
2805
  }
2806
+ checkboxContainer.classList.toggle('checked', checkbox.checked);
2807
+ // Auto-refresh timeline when task filter changes
2808
  loadTimeline();
2809
  });
2810
 
 
 
 
2811
  taskFilters.appendChild(checkboxContainer);
2812
  });
2813
 
 
2900
  const checkboxContainer = document.createElement('div');
2901
  checkboxContainer.className = 'modality-checkbox';
2902
  checkboxContainer.style.color = modality.color;
2903
+ checkboxContainer.style.setProperty('--modality-color', modality.color);
2904
 
2905
  const checkbox = document.createElement('input');
2906
  checkbox.type = 'checkbox';
 
2908
  checkbox.id = `modality-${modality.key}`;
2909
  checkbox.checked = true; // All modalities selected by default
2910
 
 
 
 
 
2911
  const label = document.createElement('label');
2912
  label.htmlFor = `modality-${modality.key}`;
2913
  label.textContent = modality.name;
2914
 
2915
  checkboxContainer.appendChild(checkbox);
 
2916
  checkboxContainer.appendChild(label);
2917
 
2918
  // Add click handler with auto-refresh