Spaces:
Sleeping
Sleeping
rowankwang
commited on
Commit
·
1c82c33
1
Parent(s):
6b7b203
randomly shuffle data
Browse files
app.py
CHANGED
@@ -1,9 +1,23 @@
|
|
1 |
import streamlit as st
|
2 |
import json
|
3 |
from streamlit_shortcuts import add_keyboard_shortcuts
|
|
|
4 |
|
5 |
st.set_page_config(layout="wide")
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
file_path = 'synth_toy_eval.json'
|
8 |
|
9 |
# Load your data
|
@@ -11,12 +25,15 @@ file_path = 'synth_toy_eval.json'
|
|
11 |
def load_data():
|
12 |
with open(file_path, 'r') as file:
|
13 |
data = json.load(file)
|
|
|
|
|
14 |
return data
|
15 |
|
16 |
def save_data(data):
|
17 |
print(file_path.split(".json")[0])
|
18 |
with open(f"{file_path.split('.json')[0]}_graded.json", 'w') as file:
|
19 |
json.dump(data, file, indent=4)
|
|
|
20 |
def download_json(data):
|
21 |
return json.dumps(data, indent=4)
|
22 |
data = load_data()
|
|
|
1 |
import streamlit as st
|
2 |
import json
|
3 |
from streamlit_shortcuts import add_keyboard_shortcuts
|
4 |
+
import random
|
5 |
|
6 |
st.set_page_config(layout="wide")
|
7 |
|
8 |
+
# import streamlit_authenticator as stauth
|
9 |
+
# import yaml
|
10 |
+
# from yaml.loader import SafeLoader
|
11 |
+
# with open('auth.yaml') as file:
|
12 |
+
# config = yaml.load(file, Loader=SafeLoader)
|
13 |
+
# authenticator = stauth.Authenticate(
|
14 |
+
# config['credentials'],
|
15 |
+
# config['cookie']['name'],
|
16 |
+
# config['cookie']['key'],
|
17 |
+
# config['cookie']['expiry_days'],
|
18 |
+
# config['preauthorized']
|
19 |
+
# )
|
20 |
+
|
21 |
file_path = 'synth_toy_eval.json'
|
22 |
|
23 |
# Load your data
|
|
|
25 |
def load_data():
|
26 |
with open(file_path, 'r') as file:
|
27 |
data = json.load(file)
|
28 |
+
random.shuffle(data)
|
29 |
+
data = data[:10]
|
30 |
return data
|
31 |
|
32 |
def save_data(data):
|
33 |
print(file_path.split(".json")[0])
|
34 |
with open(f"{file_path.split('.json')[0]}_graded.json", 'w') as file:
|
35 |
json.dump(data, file, indent=4)
|
36 |
+
|
37 |
def download_json(data):
|
38 |
return json.dumps(data, indent=4)
|
39 |
data = load_data()
|