fabiencasenave commited on
Commit
3906ca5
·
verified ·
1 Parent(s): 515b121

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -29,6 +29,8 @@ _HEADER_ = '''
29
  <h2><b>Visualization demo of <a href='https://huggingface.co/datasets/PLAID-datasets/Rotor37' target='_blank'><b>Rotor37 dataset</b></b></h2>
30
  '''
31
 
 
 
32
 
33
  def sample_info(sample_id_str, fieldn):
34
 
@@ -88,11 +90,11 @@ def sample_info(sample_id_str, fieldn):
88
  if len(hf_dataset.description['in_scalars_names'])>0:
89
  str__ += "\ninput scalars:\n"
90
  for sname in hf_dataset.description['in_scalars_names']:
91
- str__ += f"- {sname}: {plaid_sample.get_scalar(sname)}\n"
92
  if len(hf_dataset.description['out_scalars_names'])>0:
93
  str__ += "\noutput scalars:\n"
94
  for sname in hf_dataset.description['out_scalars_names']:
95
- str__ += f"- {sname}: {plaid_sample.get_scalar(sname)}\n"
96
  str__ += f"\n\nMesh number of nodes: {nodes.shape[0]}\n"
97
  if len(hf_dataset.description['in_fields_names'])>0:
98
  str__ += "\ninput fields:\n"
 
29
  <h2><b>Visualization demo of <a href='https://huggingface.co/datasets/PLAID-datasets/Rotor37' target='_blank'><b>Rotor37 dataset</b></b></h2>
30
  '''
31
 
32
+ def round_num(num)->str:
33
+ return '%s' % float('%.2g' % num)
34
 
35
  def sample_info(sample_id_str, fieldn):
36
 
 
90
  if len(hf_dataset.description['in_scalars_names'])>0:
91
  str__ += "\ninput scalars:\n"
92
  for sname in hf_dataset.description['in_scalars_names']:
93
+ str__ += f"- {sname}: {round_num(plaid_sample.get_scalar(sname))}\n"
94
  if len(hf_dataset.description['out_scalars_names'])>0:
95
  str__ += "\noutput scalars:\n"
96
  for sname in hf_dataset.description['out_scalars_names']:
97
+ str__ += f"- {sname}: {round_num(plaid_sample.get_scalar(sname))}\n"
98
  str__ += f"\n\nMesh number of nodes: {nodes.shape[0]}\n"
99
  if len(hf_dataset.description['in_fields_names'])>0:
100
  str__ += "\ninput fields:\n"