Spaces:
Sleeping
Sleeping
fabiencasenave
commited on
Commit
•
525ce44
1
Parent(s):
878eb5c
Update app.py
Browse files
app.py
CHANGED
@@ -29,6 +29,9 @@ _HEADER_ = '''
|
|
29 |
'''
|
30 |
|
31 |
|
|
|
|
|
|
|
32 |
def sample_info(sample_id_str, fieldn):
|
33 |
|
34 |
sample_ = hf_dataset[int(sample_id_str)]["sample"]
|
@@ -88,11 +91,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 |
'''
|
30 |
|
31 |
|
32 |
+
def round_num(num)->str:
|
33 |
+
return '%s' % float('%.2g' % num)
|
34 |
+
|
35 |
def sample_info(sample_id_str, fieldn):
|
36 |
|
37 |
sample_ = hf_dataset[int(sample_id_str)]["sample"]
|
|
|
91 |
if len(hf_dataset.description['in_scalars_names'])>0:
|
92 |
str__ += "\ninput scalars:\n"
|
93 |
for sname in hf_dataset.description['in_scalars_names']:
|
94 |
+
str__ += f"- {sname}: {round_num(plaid_sample.get_scalar(sname))}\n"
|
95 |
if len(hf_dataset.description['out_scalars_names'])>0:
|
96 |
str__ += "\noutput scalars:\n"
|
97 |
for sname in hf_dataset.description['out_scalars_names']:
|
98 |
+
str__ += f"- {sname}: {round_num(plaid_sample.get_scalar(sname))}\n"
|
99 |
str__ += f"\n\nMesh number of nodes: {nodes.shape[0]}\n"
|
100 |
if len(hf_dataset.description['in_fields_names'])>0:
|
101 |
str__ += "\ninput fields:\n"
|