Spaces:
Sleeping
Sleeping
Commit
·
01dbd4c
1
Parent(s):
87ec752
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,21 @@ from openai import OpenAI
|
|
7 |
import secrets
|
8 |
import pyperclip
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
client = OpenAI(
|
11 |
api_key = st.secrets["open_ai_key"]
|
12 |
)
|
|
|
7 |
import secrets
|
8 |
import pyperclip
|
9 |
|
10 |
+
f = open('test_input.json')
|
11 |
+
json_test = json.load(f)
|
12 |
+
st.json(json_test)
|
13 |
+
|
14 |
+
# Define your new dictionary that you want to save
|
15 |
+
new_data = {
|
16 |
+
'key1': 'value1',
|
17 |
+
'key2': 'value2'
|
18 |
+
}
|
19 |
+
|
20 |
+
# The 'with' statement ensures that the file is properly closed after its suite finishes
|
21 |
+
with open('data/test_output.json', 'w') as f:
|
22 |
+
# Use json.dump() to write the dictionary to the file
|
23 |
+
json.dump(new_data, f, indent=4) # `indent=4` is for pretty-printing the JSON file
|
24 |
+
|
25 |
client = OpenAI(
|
26 |
api_key = st.secrets["open_ai_key"]
|
27 |
)
|