Spaces:
Running
Running
Commit
·
9f288f7
1
Parent(s):
d9f8a09
file upload gallery
Browse files- app.py +3 -3
- vouchervision/general_utils.py +1 -1
- vouchervision/utils_VoucherVision.py +1 -1
app.py
CHANGED
|
@@ -119,7 +119,7 @@ def display_scrollable_results(JSON_results, test_results, OPT2, OPT3):
|
|
| 119 |
if JSON_results[idx] is None:
|
| 120 |
results_html += f"<p>None</p>"
|
| 121 |
else:
|
| 122 |
-
formatted_json = json.dumps(JSON_results[idx], indent=4)
|
| 123 |
results_html += f"<pre>[{opt2_readable}] + [{opt3_readable}]<br/>{formatted_json}</pre>"
|
| 124 |
|
| 125 |
# End the custom container
|
|
@@ -1252,9 +1252,9 @@ def content_header():
|
|
| 1252 |
st.markdown(f"Last JSON object in the batch: NONE")
|
| 1253 |
else:
|
| 1254 |
try:
|
| 1255 |
-
formatted_json = json.dumps(json.loads(last_JSON_response), indent=4)
|
| 1256 |
except:
|
| 1257 |
-
formatted_json = json.dumps(last_JSON_response, indent=4)
|
| 1258 |
st.markdown(f"Last JSON object in the batch:\n```\n{formatted_json}\n```")
|
| 1259 |
st.balloons()
|
| 1260 |
|
|
|
|
| 119 |
if JSON_results[idx] is None:
|
| 120 |
results_html += f"<p>None</p>"
|
| 121 |
else:
|
| 122 |
+
formatted_json = json.dumps(JSON_results[idx], indent=4, sort_keys=False)
|
| 123 |
results_html += f"<pre>[{opt2_readable}] + [{opt3_readable}]<br/>{formatted_json}</pre>"
|
| 124 |
|
| 125 |
# End the custom container
|
|
|
|
| 1252 |
st.markdown(f"Last JSON object in the batch: NONE")
|
| 1253 |
else:
|
| 1254 |
try:
|
| 1255 |
+
formatted_json = json.dumps(json.loads(last_JSON_response), indent=4, sort_keys=False)
|
| 1256 |
except:
|
| 1257 |
+
formatted_json = json.dumps(last_JSON_response, indent=4, sort_keys=False)
|
| 1258 |
st.markdown(f"Last JSON object in the batch:\n```\n{formatted_json}\n```")
|
| 1259 |
st.balloons()
|
| 1260 |
|
vouchervision/general_utils.py
CHANGED
|
@@ -37,7 +37,7 @@ def get_cfg_from_full_path(path_cfg):
|
|
| 37 |
def num_tokens_from_string(string: str, encoding_name: str) -> int:
|
| 38 |
encoding = tiktoken.get_encoding(encoding_name)
|
| 39 |
if isinstance(string, dict):
|
| 40 |
-
string = json.dumps(string)
|
| 41 |
num_tokens = len(encoding.encode(string))
|
| 42 |
return num_tokens
|
| 43 |
|
|
|
|
| 37 |
def num_tokens_from_string(string: str, encoding_name: str) -> int:
|
| 38 |
encoding = tiktoken.get_encoding(encoding_name)
|
| 39 |
if isinstance(string, dict):
|
| 40 |
+
string = json.dumps(string, sort_keys=False)
|
| 41 |
num_tokens = len(encoding.encode(string))
|
| 42 |
return num_tokens
|
| 43 |
|
vouchervision/utils_VoucherVision.py
CHANGED
|
@@ -481,7 +481,7 @@ class VoucherVision():
|
|
| 481 |
'''Writes dictionary data to a JSON file.'''
|
| 482 |
with open(filepath, 'w') as txt_file:
|
| 483 |
if isinstance(data, dict):
|
| 484 |
-
data = json.dumps(data, indent=4)
|
| 485 |
txt_file.write(data)
|
| 486 |
|
| 487 |
def create_null_json(self):
|
|
|
|
| 481 |
'''Writes dictionary data to a JSON file.'''
|
| 482 |
with open(filepath, 'w') as txt_file:
|
| 483 |
if isinstance(data, dict):
|
| 484 |
+
data = json.dumps(data, indent=4, sort_keys=False)
|
| 485 |
txt_file.write(data)
|
| 486 |
|
| 487 |
def create_null_json(self):
|