guipenedo HF Staff commited on
Commit
21e9245
·
unverified ·
1 Parent(s): 836604e

change output json

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -55,9 +55,9 @@ def export_data(exported_data: MetricStatsDict, metric_name: str):
55
  # Assuming exported_data is a dictionary where the key is the dataset name and the value is the data to be exported
56
  with tempfile.NamedTemporaryFile(mode="w", delete=False, prefix=metric_name, suffix=".json") as temp:
57
  json.dump({
58
- name: dt.to_dict()
59
  for name, dt in exported_data.items()
60
- }, temp)
61
  temp_path = temp.name
62
  return gr.update(visible=True, value=temp_path)
63
 
 
55
  # Assuming exported_data is a dictionary where the key is the dataset name and the value is the data to be exported
56
  with tempfile.NamedTemporaryFile(mode="w", delete=False, prefix=metric_name, suffix=".json") as temp:
57
  json.dump({
58
+ name: sorted([{"value": key, **value} for key, value in dt.to_dict().items()], key=lambda x: x["value"])
59
  for name, dt in exported_data.items()
60
+ }, temp, indent=2)
61
  temp_path = temp.name
62
  return gr.update(visible=True, value=temp_path)
63