SuveenE commited on
Commit
5541b9f
·
1 Parent(s): 4bfae70

Update stats for v2

Browse files
Files changed (1) hide show
  1. app.py +21 -4
app.py CHANGED
@@ -112,7 +112,11 @@ def fetch_stats_for_selected(selected_datasets: List[str], progress=gr.Progress(
112
  'stats': stats
113
  })
114
  else:
115
- non_v3_results.append(f"{repo_id}: **{episodes}** episodes")
 
 
 
 
116
 
117
  except Exception as e:
118
  errors.append(f"❌ {repo_id}: Error - {str(e)}")
@@ -130,14 +134,19 @@ def fetch_stats_for_selected(selected_datasets: List[str], progress=gr.Progress(
130
  else:
131
  return f"{secs}s"
132
 
133
- # Calculate total duration across all datasets
134
  total_duration_seconds = 0
135
  for datasets in v3_by_date.values():
136
  for d in datasets:
137
- info_meta = d['stats'].get('info_metadata', {})
138
  if info_meta.get('total_frames'):
139
  fps = info_meta.get('fps', 30)
140
  total_duration_seconds += info_meta['total_frames'] / fps
 
 
 
 
 
141
 
142
  # Build output with total episodes and duration
143
  duration_display = f" • {format_duration(total_duration_seconds)}" if total_duration_seconds > 0 else ""
@@ -188,7 +197,15 @@ def fetch_stats_for_selected(selected_datasets: List[str], progress=gr.Progress(
188
 
189
  # Display non-v3 datasets
190
  if non_v3_results:
191
- output.extend(non_v3_results)
 
 
 
 
 
 
 
 
192
 
193
  # Display errors at the end
194
  if errors:
 
112
  'stats': stats
113
  })
114
  else:
115
+ non_v3_results.append({
116
+ 'repo_id': repo_id,
117
+ 'episodes': episodes,
118
+ 'stats': stats
119
+ })
120
 
121
  except Exception as e:
122
  errors.append(f"❌ {repo_id}: Error - {str(e)}")
 
134
  else:
135
  return f"{secs}s"
136
 
137
+ # Calculate total duration across all datasets (v3 and v2)
138
  total_duration_seconds = 0
139
  for datasets in v3_by_date.values():
140
  for d in datasets:
141
+ info_meta = d['stats'].get('info_metadata', {}) or {}
142
  if info_meta.get('total_frames'):
143
  fps = info_meta.get('fps', 30)
144
  total_duration_seconds += info_meta['total_frames'] / fps
145
+ for d in non_v3_results:
146
+ info_meta = d['stats'].get('info_metadata', {}) or {}
147
+ if info_meta.get('total_frames'):
148
+ fps = info_meta.get('fps', 30)
149
+ total_duration_seconds += info_meta['total_frames'] / fps
150
 
151
  # Build output with total episodes and duration
152
  duration_display = f" • {format_duration(total_duration_seconds)}" if total_duration_seconds > 0 else ""
 
197
 
198
  # Display non-v3 datasets
199
  if non_v3_results:
200
+ for d in non_v3_results:
201
+ info_meta = d['stats'].get('info_metadata', {}) or {}
202
+ duration_str = ""
203
+ if info_meta.get('total_frames'):
204
+ total_frames = info_meta['total_frames']
205
+ fps = info_meta.get('fps', 30)
206
+ duration_seconds = total_frames / fps
207
+ duration_str = f" • {format_duration(duration_seconds)}"
208
+ output.append(f"{d['repo_id']}: **{d['episodes']}** episodes{duration_str}")
209
 
210
  # Display errors at the end
211
  if errors: