hugging
#1
by
ratneshpasi03
- opened
- .devcontainer/devcontainer.json +33 -0
- .gitattributes +0 -1
- .gitignore +1 -1
- README.md +2 -2
- app.py +0 -4
- data/questions/2/answer.txt +0 -1
- data/questions/2/code.py +0 -10
- data/questions/2/metadata.json +0 -9
- data/questions/2/question.txt +0 -1
- data/questions/3/answer.txt +0 -3
- data/questions/3/code.py +0 -25
- data/questions/3/metadata.json +0 -9
- data/questions/3/question.txt +0 -1
- data/raw_data/Data.csv +0 -3
- data/raw_data/NCAP_Funding.csv +0 -118
- data/raw_data/State_data.csv +0 -32
- output.jsonl +2 -1
- pages/3_Add_Questions.py +0 -11
- pages/5_Delete_Question.py +1 -1
- utils/save_to_hf.py +0 -34
.devcontainer/devcontainer.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "Python 3",
|
3 |
+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
4 |
+
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
|
5 |
+
"customizations": {
|
6 |
+
"codespaces": {
|
7 |
+
"openFiles": [
|
8 |
+
"README.md",
|
9 |
+
"app.py"
|
10 |
+
]
|
11 |
+
},
|
12 |
+
"vscode": {
|
13 |
+
"settings": {},
|
14 |
+
"extensions": [
|
15 |
+
"ms-python.python",
|
16 |
+
"ms-python.vscode-pylance"
|
17 |
+
]
|
18 |
+
}
|
19 |
+
},
|
20 |
+
"updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y <packages.txt; [ -f requirements.txt ] && pip3 install --user -r requirements.txt; pip3 install --user streamlit; echo 'β
Packages installed and Requirements met'",
|
21 |
+
"postAttachCommand": {
|
22 |
+
"server": "streamlit run app.py --server.enableCORS false --server.enableXsrfProtection false"
|
23 |
+
},
|
24 |
+
"portsAttributes": {
|
25 |
+
"8501": {
|
26 |
+
"label": "Application",
|
27 |
+
"onAutoForward": "openPreview"
|
28 |
+
}
|
29 |
+
},
|
30 |
+
"forwardPorts": [
|
31 |
+
8501
|
32 |
+
]
|
33 |
+
}
|
.gitattributes
CHANGED
@@ -33,4 +33,3 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
-
data/raw_data/Data.csv filter=lfs diff=lfs merge=lfs -text
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
.gitignore
CHANGED
@@ -4,4 +4,4 @@ __pycache__/
|
|
4 |
*.pyo
|
5 |
|
6 |
# Ignore CSV's present in raw_data folder
|
7 |
-
|
|
|
4 |
*.pyo
|
5 |
|
6 |
# Ignore CSV's present in raw_data folder
|
7 |
+
*/raw_data
|
README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
---
|
2 |
title: VayuBuddy Question And Answer
|
3 |
emoji: π
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.42.0
|
8 |
app_file: app.py
|
|
|
1 |
---
|
2 |
title: VayuBuddy Question And Answer
|
3 |
emoji: π
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: red
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.42.0
|
8 |
app_file: app.py
|
app.py
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
-
from utils.save_to_hf import commit_and_push_changes
|
3 |
|
4 |
st.set_page_config(page_title="Coding Questions App", layout="wide")
|
5 |
st.title("Welcome to the Coding Questions App!")
|
6 |
|
7 |
st.write("Use the sidebar to navigate between pages.")
|
8 |
-
|
9 |
-
if st.sidebar.button("Save to HF"):
|
10 |
-
commit_and_push_changes()
|
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
st.set_page_config(page_title="Coding Questions App", layout="wide")
|
4 |
st.title("Welcome to the Coding Questions App!")
|
5 |
|
6 |
st.write("Use the sidebar to navigate between pages.")
|
|
|
|
|
|
data/questions/2/answer.txt
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Andhra Pradesh
|
|
|
|
data/questions/2/code.py
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
def true_code():
|
2 |
-
import pandas as pd
|
3 |
-
|
4 |
-
df = pd.read_csv('data/raw_data/Data.csv', sep=",")
|
5 |
-
|
6 |
-
data = df[df['PM2.5'] > 300]
|
7 |
-
ans = data.groupby(['state', 'station']).value_counts().idxmax()[0]
|
8 |
-
print(ans)
|
9 |
-
|
10 |
-
true_code()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/questions/2/metadata.json
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"question_id": 2,
|
3 |
-
"category": "spatial",
|
4 |
-
"answer_category": "single",
|
5 |
-
"plot": false,
|
6 |
-
"libraries": [
|
7 |
-
"pandas"
|
8 |
-
]
|
9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/questions/2/question.txt
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Which state had the most days with hazardous PM2.5 levels (above 300 Β΅g/mΒ³)?
|
|
|
|
data/questions/3/answer.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
Winter Average PM2.5: 67.4923443634478
|
2 |
-
Monsoon Average PM2.5: 34.42519611317571
|
3 |
-
Summer Average PM2.5: nan
|
|
|
|
|
|
|
|
data/questions/3/code.py
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
def true_code():
|
2 |
-
import pandas as pd
|
3 |
-
|
4 |
-
df = pd.read_csv('data/raw_data/Data.csv', sep=",")
|
5 |
-
|
6 |
-
df['Timestamp'] = pd.to_datetime(df['Timestamp'])
|
7 |
-
df['Year'] = df['Timestamp'].dt.year
|
8 |
-
df['Month'] = df['Timestamp'].dt.month
|
9 |
-
|
10 |
-
data = df[df['Year'] == 2018]
|
11 |
-
data = data[data['station'] == 'Lal Bahadur Shastri Nagar, Kalaburagi - KSPCB']
|
12 |
-
|
13 |
-
winter_data = data[(data['Month'] == 12) | (data['Month'] <= 2)]
|
14 |
-
summer_data = data[(data['Month'] >= 3) & (data['Month'] <= 5)]
|
15 |
-
monsoon_data = data[(data['Month'] >= 6) & (data['Month'] <= 9)]
|
16 |
-
|
17 |
-
summer_avg = summer_data['PM2.5'].mean()
|
18 |
-
winter_avg = winter_data['PM2.5'].mean()
|
19 |
-
monsoon_avg = monsoon_data['PM2.5'].mean()
|
20 |
-
|
21 |
-
print("Winter Average PM2.5:", winter_avg)
|
22 |
-
print("Monsoon Average PM2.5:", monsoon_avg)
|
23 |
-
print("Summer Average PM2.5:", summer_avg)
|
24 |
-
|
25 |
-
true_code()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/questions/3/metadata.json
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"question_id": 3,
|
3 |
-
"category": "temporal",
|
4 |
-
"answer_category": "multiple",
|
5 |
-
"plot": false,
|
6 |
-
"libraries": [
|
7 |
-
"pandas"
|
8 |
-
]
|
9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/questions/3/question.txt
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
For the year 2018, calculate the average PM2.5 concentration for each season (Winter: December-February, Summer: March-May, and Monsoon: June-September) for station Lal Bahadur Shastri Nagar, Kalaburagi - KSPCB. Identify the season with the highest pollution and suggest potential factors contributing to the increase.
|
|
|
|
data/raw_data/Data.csv
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:77ea5aff6c41f6e8e5562a75ec4ac97f498debd706d3a047e1b57a9d8bd42be1
|
3 |
-
size 266893056
|
|
|
|
|
|
|
|
data/raw_data/NCAP_Funding.csv
DELETED
@@ -1,118 +0,0 @@
|
|
1 |
-
S. No.,State,City,Amount released during FY 2019-20,Amount released during FY 2020-21,Amount released during FY 2021-22,Total fund released,Utilisation as on June 2022
|
2 |
-
1,Andhra Pradesh,Vijaywada,6,-,-,6,22.91
|
3 |
-
2,Andhra Pradesh,Guntur,0.12,0.76,1.96,2.84,22.91
|
4 |
-
3,Andhra Pradesh,Kurnool,0.06,0.76,1.36,2.18,22.91
|
5 |
-
4,Andhra Pradesh,Nellore,0.06,0.76,1.92,2.74,22.91
|
6 |
-
5,Andhra Pradesh,Visakhapatnam,0.12,-,-,0.12,22.91
|
7 |
-
6,Andhra Pradesh,Srikakulam,-,2,0.49,2.49,22.91
|
8 |
-
7,Andhra Pradesh,Chitoor,-,2,0.46,2.46,22.91
|
9 |
-
8,Andhra Pradesh,Ongole,-,2,0.64,2.64,22.91
|
10 |
-
9,Andhra Pradesh,vizianagaram,-,2,0.83,2.83,22.91
|
11 |
-
10,Andhra Pradesh,Eluru,-,2,0.82,2.82,22.91
|
12 |
-
11,Andhra Pradesh,Rajahmundry,-,2,1.13,3.13,22.91
|
13 |
-
12,Andhra Pradesh,Anantapur,-,2,1.04,3.04,22.91
|
14 |
-
13,Andhra Pradesh,Kadapa,-,1,0.83,1.83,22.91
|
15 |
-
14,Assam,Guwahati,0.12,5,-,5.12,1.45
|
16 |
-
15,Assam,Nagaon,0.06,2,-,2.06,1.45
|
17 |
-
16,Assam,Nalbari,0.06,1,-,1.06,1.45
|
18 |
-
17,Assam,Sibsagar,0.06,2,-,2.06,1.45
|
19 |
-
18,Assam,Silchar,0.06,2,-,2.06,1.45
|
20 |
-
19,Bihar,Patna,10,-,-,10,15.2
|
21 |
-
20,Bihar,Gaya,0.1,2,1.9,4,15.2
|
22 |
-
21,Bihar,Muzaffarpur,0.1,5,2.5,7.6,15.2
|
23 |
-
22,Chandigarh,Chandigarh,8.28,5,4.61,17.89,10.83
|
24 |
-
23,Chhattisgarh,Raipur,6,-,-,6,2.76
|
25 |
-
24,Chhattisgarh,Durg Bhilainagar,6,-,-,6,2.76
|
26 |
-
25,Chhattisgarh,Korba,0.06,1,-,1.06,2.76
|
27 |
-
26,Delhi,Delhi,-,-,11.25,11.25,-
|
28 |
-
27,Gujarat,Surat,6,-,-,6,12
|
29 |
-
28,Gujarat,Ahmedabad,6,-,-,6,12
|
30 |
-
29,Himachal Pradesh,Baddi (Baddi&nalagarh considered twin during FY 20-21),0.06,3,0.2,3.26,6.35
|
31 |
-
30,Himachal Pradesh,Nalagarh,0.06,-,0.06,0.12,6.35
|
32 |
-
31,Himachal Pradesh,Paonta Sahib,0.06,1,0.1,1.16,6.35
|
33 |
-
32,Himachal Pradesh,Sunder Nagar,0.06,1,0.08,1.14,6.35
|
34 |
-
33,Himachal Pradesh,Kala Amb,-,3,0,3,6.35
|
35 |
-
34,Himachal Pradesh,Damtal,-,1,0.01,1.01,6.35
|
36 |
-
35,Himachal Pradesh,Parwanoo,-,1,0.03,1.03,6.35
|
37 |
-
36,Jammu & Kashmir,Jammu,0.12,3,4.89,8.01,0.12
|
38 |
-
37,Jammu & Kashmir,Srinagar,-,5,7.95,12.95,0.12
|
39 |
-
38,Jharkhand,Dhanbad,6,-,-,6,3
|
40 |
-
39,Karnataka,Bangalore,6,-,-,6,7.39
|
41 |
-
40,Karnataka,Gulburga,0.12,0.38,2.24,2.74,7.39
|
42 |
-
41,Karnataka,Hubli-Dharwad,0.12,0.38,3.68,4.18,7.39
|
43 |
-
42,Karnataka,Devangere,0.06,0.76,1.4,2.22,7.39
|
44 |
-
43,Madhya Pradesh,Bhopal,10,-,-,10,20.96
|
45 |
-
44,Madhya Pradesh,Gwalior,10,-,-,10,20.96
|
46 |
-
45,Madhya Pradesh,Indore,0.2,-,-,0.2,20.96
|
47 |
-
46,Madhya Pradesh,Ujjain,0.2,0.38,2.33,2.91,20.96
|
48 |
-
47,Madhya Pradesh,Sagar,0.1,0.76,1.36,2.22,20.96
|
49 |
-
48,Madhya Pradesh,Dewas,0.1,0.38,1.33,1.81,20.96
|
50 |
-
49,Maharashtra,Mumbai,9.5,-,-,9.5,29.92
|
51 |
-
50,Maharashtra,Nagpur,9.45,-,-,9.45,29.92
|
52 |
-
51,Maharashtra,Navi Mumbai,9.45,-,-,9.45,29.92
|
53 |
-
52,Maharashtra,Pune,9.45,-,-,9.45,29.92
|
54 |
-
53,Maharashtra,Amravati,0.2,1.14,2.91,4.25,29.92
|
55 |
-
54,Maharashtra,Aurangabad,0.2,-,-,0.2,29.92
|
56 |
-
55,Maharashtra,Nashik,0.2,-,-,0.2,29.92
|
57 |
-
56,Maharashtra,Kolhapur,0.2,0.76,-,0.96,29.92
|
58 |
-
57,Maharashtra,Sangli,0.2,0.76,1.72,2.68,29.92
|
59 |
-
58,Maharashtra,Solapur,0.2,0.38,4.2,4.78,29.92
|
60 |
-
59,Maharashtra,Ulhasnagar,0.2,1.9,-,2.1,29.92
|
61 |
-
60,Maharashtra,Akola,0.1,1.14,1.47,2.71,29.92
|
62 |
-
61,Maharashtra,Badlapur,0.1,1.9,-,2,29.92
|
63 |
-
62,Maharashtra,Chandrapur,0.1,1.14,-,1.24,29.92
|
64 |
-
63,Maharashtra,Jalgaon,0.1,0.76,-,0.86,29.92
|
65 |
-
64,Maharashtra,Jalna,0.1,1.14,-,1.24,29.92
|
66 |
-
65,Maharashtra,Latur,0.1,0.38,1.6,2.08,29.92
|
67 |
-
66,Meghalaya,Byrnihat,-,3,0,3,1.97
|
68 |
-
67,Nagaland,Dimapur,0.06,3,0.53,3.59,6.12
|
69 |
-
68,Nagaland,Kohima,0.06,3,0.4,3.46,6.12
|
70 |
-
69,Odisha,Twin City Bhubaneshwar & Cuttack,6,-,-,6,3.62
|
71 |
-
70,Odisha,Balasore,0.06,0.76,-,0.82,3.62
|
72 |
-
71,Odisha,Rourkela,0.06,1.14,-,1.2,3.62
|
73 |
-
72,Odisha,Angul,0.06,1.14,-,1.2,3.62
|
74 |
-
73,Odisha,Kalinga Nagar,-,3,-,3,3.62
|
75 |
-
74,Odisha,Talcher,-,-,0.22,0.22,3.62
|
76 |
-
75,Odisha,Cuttack,-,-,3.42,3.42,3.62
|
77 |
-
76,Punjab,Ludhiana,6,-,-,6,3.02
|
78 |
-
77,Punjab,Amritsar,6,-,-,6,3.02
|
79 |
-
78,Punjab,Jalandhar,0.12,4,-,4.12,3.02
|
80 |
-
79,Punjab,Khanna,0.06,1.9,-,1.96,3.02
|
81 |
-
80,Punjab,Gobindgarh,0.06,3,-,3.06,3.02
|
82 |
-
81,Punjab,NayaNangal,0.06,1,-,1.06,3.02
|
83 |
-
82,Punjab,Dera Baba Nanak,0.06,0.76,-,0.82,3.02
|
84 |
-
83,Punjab,Patiala,0.06,4,-,4.06,3.02
|
85 |
-
84,Punjab,DeraBassi,0.06,0.38,-,0.44,3.02
|
86 |
-
85,Rajasthan,Jaipur,6,-,-,6,12.55
|
87 |
-
86,Rajasthan,Jodhpur,6,-,-,6,12.55
|
88 |
-
87,Rajasthan,Kota,6,-,-,6,12.55
|
89 |
-
88,Rajasthan,Alwar,0.06,1.9,-,1.96,12.55
|
90 |
-
89,Rajasthan,Udaipur,0.06,1.9,-,1.96,12.55
|
91 |
-
90,Tamil Nadu,Tuticorin,0.06,3,-,3.06,-
|
92 |
-
91,Telangana,Hyderabad,10.8,-,-,10.8,9.72
|
93 |
-
92,Telangana,Nalgonda,0.1,0.38,0.47,0.95,9.72
|
94 |
-
93,Telangana,Patencheru,0.1,0.38,-,0.48,9.72
|
95 |
-
94,Telangana,Sangareddy,-,2,0.32,2.32,9.72
|
96 |
-
95,Uttar Pradesh,Agra,9.45,-,-,9.45,30.57
|
97 |
-
96,Uttar Pradesh,Allahabad,9.45,-,-,9.45,30.57
|
98 |
-
97,Uttar Pradesh,Kanpur,9.45,-,-,9.45,30.57
|
99 |
-
98,Uttar Pradesh,Lucknow,9.45,-,-,9.45,30.57
|
100 |
-
99,Uttar Pradesh,Varanasi,9.47,-,-,9.47,30.57
|
101 |
-
100,Uttar Pradesh,Moradabad,0.2,1.9,-,2.1,30.57
|
102 |
-
101,Uttar Pradesh,Bareily,0.2,1.9,-,2.1,30.57
|
103 |
-
102,Uttar Pradesh,Firozabad,0.2,1.9,-,2.1,30.57
|
104 |
-
103,Uttar Pradesh,Jhansi,0.2,1.14,-,1.34,30.57
|
105 |
-
104,Uttar Pradesh,Khurja,0.1,1.9,-,2,30.57
|
106 |
-
105,Uttar Pradesh,Anpara,0.1,1.14,-,1.24,30.57
|
107 |
-
106,Uttar Pradesh,Gajraula,0.1,1.14,-,1.24,30.57
|
108 |
-
107,Uttar Pradesh,Raebareli,0.1,1.14,-,1.24,30.57
|
109 |
-
108,Uttar Pradesh,Gorakhpur,-,-,9.64,9.64,30.57
|
110 |
-
109,Uttar Pradesh,Noida,-,-,6.67,6.67,30.57
|
111 |
-
110,Uttarakhand,Kashipur,0.06,3,0.79,3.85,8.15
|
112 |
-
111,Uttarakhand,Rishikesh,0.06,5,-,5.06,8.15
|
113 |
-
112,Uttarakhand,Dehradun,-,3,4.88,7.88,8.15
|
114 |
-
113,West Bengal,Kolkata,6,-,-,6,19
|
115 |
-
114,West Bengal,Howrah,-,5,-,5,19
|
116 |
-
115,West Bengal,Haldia,-,3,-,3,19
|
117 |
-
116,West Bengal,Durgapur,-,3,-,3,19
|
118 |
-
117,West Bengal,Barrackpore,-,2,-,2,19
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/raw_data/State_data.csv
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
State,Population,Area (km2)
|
2 |
-
Uttar Pradesh,199812341,240928
|
3 |
-
Maharashtra,112374333,307713
|
4 |
-
Bihar,104099452,94163
|
5 |
-
West Bengal,91276115,88752
|
6 |
-
Madhya Pradesh,72626809,308252
|
7 |
-
Tamil Nadu,72147030,130058
|
8 |
-
Rajasthan,68548437,342239
|
9 |
-
Karnataka,61095297,191791
|
10 |
-
Gujarat,60439692,196024
|
11 |
-
Andhra Pradesh,49577103,162975
|
12 |
-
Odisha,41974219,155707
|
13 |
-
Telangana,35003674,112077
|
14 |
-
Kerala,33406061,38863
|
15 |
-
Jharkhand,32988134,79716
|
16 |
-
Assam,31205576,78438
|
17 |
-
Punjab,27743338,50362
|
18 |
-
Chhattisgarh,25545198,135192
|
19 |
-
Delhi,16787941,1484
|
20 |
-
Haryana,25351462,44212
|
21 |
-
Jammu and Kashmir,12267032,42241
|
22 |
-
Uttarakhand,10086292,53483
|
23 |
-
Himachal Pradesh,6864602,55673
|
24 |
-
Tripura,3673917,10491
|
25 |
-
Manipur,2570390,22327
|
26 |
-
Meghalaya,2966889,22429
|
27 |
-
Nagaland,1978502,16579
|
28 |
-
Arunachal Pradesh,1383727,83743
|
29 |
-
Puducherry,1247953,479
|
30 |
-
Mizoram,1097206,21081
|
31 |
-
Chandigarh,1055450,114
|
32 |
-
Sikkim,610577,7096
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
output.jsonl
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
{"folder":
|
|
|
|
1 |
+
{"folder": "0", "question": "Which state has the highest average PM2.5 concentration across all stations?", "answer": "Delhi", "code": "def true_code():\n import pandas as pd\n \n df = pd.read_csv('data/raw_data/Data.csv', sep=\",\")\n \n data = df.groupby(['state','station'])['PM2.5'].mean()\n ans = data.idxmax()[0]\n print(ans)\n\ntrue_code()", "metadata": {"question_id": 0, "category": "spatial", "answer_category": "single", "plot": false, "libraries": ["pandas"]}}
|
2 |
+
{"folder": "1", "question": "Report the station that recorded the highest value of PM 2.5 for the month Aug of 2020", "answer": "Lal Bahadur Shastri Nagar, Kalaburagi ", "code": "def true_code():\n import pandas as pd\n \n df = pd.read_csv('data/raw_data/Data.csv', sep=\",\")\n \n df['Timestamp'] = pd.to_datetime(df['Timestamp'])\n \n df['Year'] = df['Timestamp'].dt.year\n df['Month'] = df['Timestamp'].dt.month\n data = df[(df['Year'] == 2020) & (df['Month'] == 8)]\n ans = data.groupby('station')['PM2.5'].max().idxmax()\n print(ans)\n\ntrue_code()", "metadata": {"question_id": 2, "category": "temporal", "answer_category": "double", "plot": false, "libraries": ["pandas"]}}
|
pages/3_Add_Questions.py
CHANGED
@@ -52,17 +52,6 @@ if st.button("Save Question"):
|
|
52 |
with open(question_dir / "metadata.json", "w", encoding="utf-8") as f:
|
53 |
json.dump(metadata, f, indent=4)
|
54 |
|
55 |
-
new_entry = {
|
56 |
-
"folder": question_id,
|
57 |
-
"question": question_text,
|
58 |
-
"answer": answer_text,
|
59 |
-
"code": formatted_code,
|
60 |
-
"metadata": metadata
|
61 |
-
}
|
62 |
-
|
63 |
-
with open ("output.jsonl", "a", encoding="utf-8") as f:
|
64 |
-
f.write(json.dumps(new_entry, ensure_ascii=False) + "\n")
|
65 |
-
|
66 |
st.success(f"β
Question saved successfully! (ID: {question_id})")
|
67 |
st.info("refresh in-order to see the applied changes")
|
68 |
if st.button("refresh") :
|
|
|
52 |
with open(question_dir / "metadata.json", "w", encoding="utf-8") as f:
|
53 |
json.dump(metadata, f, indent=4)
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
st.success(f"β
Question saved successfully! (ID: {question_id})")
|
56 |
st.info("refresh in-order to see the applied changes")
|
57 |
if st.button("refresh") :
|
pages/5_Delete_Question.py
CHANGED
@@ -62,7 +62,7 @@ if selected_question:
|
|
62 |
question_folder = DATA_DIR / str(selected_question_id)
|
63 |
if question_folder.exists():
|
64 |
shutil.rmtree(question_folder)
|
65 |
-
rename_folders(selected_question_id)
|
66 |
st.success(f"β
Question ID {selected_question_id} deleted successfully!")
|
67 |
st.info("Refresh to see the applied changes")
|
68 |
if st.button("Refresh"):
|
|
|
62 |
question_folder = DATA_DIR / str(selected_question_id)
|
63 |
if question_folder.exists():
|
64 |
shutil.rmtree(question_folder)
|
65 |
+
rename_folders(selected_question_id)
|
66 |
st.success(f"β
Question ID {selected_question_id} deleted successfully!")
|
67 |
st.info("Refresh to see the applied changes")
|
68 |
if st.button("Refresh"):
|
utils/save_to_hf.py
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
def commit_and_push_changes():
|
2 |
-
import os
|
3 |
-
import subprocess
|
4 |
-
from pathlib import Path
|
5 |
-
|
6 |
-
# Define the paths
|
7 |
-
REPO_DIR = Path(".") # Root directory of your Hugging Face Space repo
|
8 |
-
DATA_DIR = REPO_DIR / "data/questions" # Persistent storage in the repo
|
9 |
-
JSONL_FILE = REPO_DIR / "output.jsonl"
|
10 |
-
|
11 |
-
DATA_DIR.mkdir(parents=True, exist_ok=True) # Ensure directory exists
|
12 |
-
|
13 |
-
GIT_USER = os.getenv("GIT_USER")
|
14 |
-
GIT_EMAIL = os.getenv("GIT_EMAIL")
|
15 |
-
HF_OWNER = os.getenv("HF_OWNER")
|
16 |
-
HF_TOKEN = os.getenv("HF_TOKEN")
|
17 |
-
REPO_NAME = os.getenv("REPO_NAME")
|
18 |
-
REPO_URL = f"https://{HF_OWNER}:{HF_TOKEN}@huggingface.co/spaces/{REPO_NAME}"
|
19 |
-
|
20 |
-
# Set remote URL before pushing
|
21 |
-
|
22 |
-
"""Automates Git add, commit, and push for updated data."""
|
23 |
-
try:
|
24 |
-
# Run Git commands
|
25 |
-
subprocess.run(["git", "config", "--global", "user.name", GIT_USER], check=True)
|
26 |
-
subprocess.run(["git", "config", "--global", "user.email", GIT_EMAIL], check=True)
|
27 |
-
subprocess.run(["git", "remote", "set-url", "origin", REPO_URL], check=True)
|
28 |
-
subprocess.run(["git", "add", "--all"], check=True)
|
29 |
-
subprocess.run(["git", "commit", "-m", "Update questions data"], check=True)
|
30 |
-
subprocess.run(["git", "push", "origin", "main"], check=True)
|
31 |
-
print("β
Data committed and pushed successfully!")
|
32 |
-
|
33 |
-
except subprocess.CalledProcessError as e:
|
34 |
-
print(f"β Git operation failed: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|