From 6f288ffd4ee14b31b0d073eb08eab630c5262102 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:45:37 +0530 Subject: [PATCH 01/73] Update streamlit_app.py --- streamlit_app.py | 93 +++++++++++++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 36 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 7a0ed1272052..16a9191709b6 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -2,39 +2,60 @@ import numpy as np import pandas as pd import streamlit as st - -""" -# Welcome to Streamlit! - -Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:. -If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community -forums](https://discuss.streamlit.io). - -In the meantime, below is an example of what you can do with just a few lines of code: -""" - -num_points = st.slider("Number of points in spiral", 1, 10000, 1100) -num_turns = st.slider("Number of turns in spiral", 1, 300, 31) - -indices = np.linspace(0, 1, num_points) -theta = 2 * np.pi * num_turns * indices -radius = indices - -x = radius * np.cos(theta) -y = radius * np.sin(theta) - -df = pd.DataFrame({ - "x": x, - "y": y, - "idx": indices, - "rand": np.random.randn(num_points), -}) - -st.altair_chart(alt.Chart(df, height=700, width=700) - .mark_point(filled=True) - .encode( - x=alt.X("x", axis=None), - y=alt.Y("y", axis=None), - color=alt.Color("idx", legend=None, scale=alt.Scale()), - size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])), - )) +from chatterbot import ChatBot +from chatterbot.trainers import ChatterBotCorpusTrainer + +# Initialize ChatBot +chatbot = ChatBot('EducationBot') +trainer = ChatterBotCorpusTrainer(chatbot) +trainer.train('chatterbot.corpus.english') + +# Dummy student database (replace with your database integration) +students = { + 'Alice': {'marks': 85}, + 'Bob': {'marks': 70}, + 'Charlie': {'marks': 60} +} + +# Function to check admission criteria +def check_admission(student_name): + if student_name in students: + marks = students[student_name]['marks'] + if marks >= 75: + return f"{student_name} is admitted!" + else: + return f"{student_name} does not meet admission criteria." + else: + return f"{student_name} is not found in the database." + +# Streamlit UI +st.title('Education System') + +# Add new student form +st.subheader('Add New Student') +new_student_name = st.text_input('Enter student name:') +new_student_marks = st.number_input('Enter student marks:', min_value=0, max_value=100) + +if st.button('Add Student'): + students[new_student_name] = {'marks': new_student_marks} + st.success(f'{new_student_name} added successfully!') + +# View existing students and marks +st.subheader('Existing Students and Marks') +for student, details in students.items(): + st.write(f'{student}: {details["marks"]}') + +# Chatbot interface +st.subheader('Chat with EducationBot') +user_input = st.text_input('You:') + +if st.button('Send'): + response = chatbot.get_response(user_input) + st.write('EducationBot:', response) + +# Admission checker +st.subheader('Admission Checker') +admission_student = st.text_input('Enter student name to check admission:') +if st.button('Check Admission'): + admission_result = check_admission(admission_student) + st.write(admission_result) From 1ea2b5585e48ffa28649db9f0b5071484fde0de5 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:56:11 +0530 Subject: [PATCH 02/73] Update streamlit_app.py --- streamlit_app.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 16a9191709b6..d0fc9324e4d5 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -2,14 +2,6 @@ import numpy as np import pandas as pd import streamlit as st -from chatterbot import ChatBot -from chatterbot.trainers import ChatterBotCorpusTrainer - -# Initialize ChatBot -chatbot = ChatBot('EducationBot') -trainer = ChatterBotCorpusTrainer(chatbot) -trainer.train('chatterbot.corpus.english') - # Dummy student database (replace with your database integration) students = { 'Alice': {'marks': 85}, @@ -59,3 +51,21 @@ def check_admission(student_name): if st.button('Check Admission'): admission_result = check_admission(admission_student) st.write(admission_result) +# Streamlit Chatbot +# Define responses +responses = { + "hi": "Hello!", + "how are you?": "I'm fine, thank you!", + "what's your name?": "I'm a simple chatbot.", + "bye": "Goodbye!" +} + +# Streamlit UI +st.title('Simple Chatbot') + +# Chatbot interface +user_input = st.text_input('You:') +if st.button('Send'): + response = responses.get(user_input.lower(), "Sorry, I don't understand.") + st.write('Chatbot:', response) + From 1dcfc059697e1961416d6f404a8824bbab059cc2 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 13:59:21 +0530 Subject: [PATCH 03/73] Update streamlit_app.py --- streamlit_app.py | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index d0fc9324e4d5..7688bff159e7 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -2,6 +2,7 @@ import numpy as np import pandas as pd import streamlit as st + # Dummy student database (replace with your database integration) students = { 'Alice': {'marks': 85}, @@ -20,6 +21,13 @@ def check_admission(student_name): else: return f"{student_name} is not found in the database." +# Function to handle chatbot responses +def get_chatbot_response(user_input, students): + if user_input.strip() == 'view students': + return '\n'.join([f'{student}: {details["marks"]}' for student, details in students.items()]) + else: + return str(chatbot.get_response(user_input)) + # Streamlit UI st.title('Education System') @@ -42,7 +50,7 @@ def check_admission(student_name): user_input = st.text_input('You:') if st.button('Send'): - response = chatbot.get_response(user_input) + response = get_chatbot_response(user_input, students) st.write('EducationBot:', response) # Admission checker @@ -51,21 +59,3 @@ def check_admission(student_name): if st.button('Check Admission'): admission_result = check_admission(admission_student) st.write(admission_result) -# Streamlit Chatbot -# Define responses -responses = { - "hi": "Hello!", - "how are you?": "I'm fine, thank you!", - "what's your name?": "I'm a simple chatbot.", - "bye": "Goodbye!" -} - -# Streamlit UI -st.title('Simple Chatbot') - -# Chatbot interface -user_input = st.text_input('You:') -if st.button('Send'): - response = responses.get(user_input.lower(), "Sorry, I don't understand.") - st.write('Chatbot:', response) - From 5e1106de8d7bb2688e210a0b3ffcbb24d2346f31 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:06:39 +0530 Subject: [PATCH 04/73] Update streamlit_app.py --- streamlit_app.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 7688bff159e7..29a6ff6ff753 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,6 +1,3 @@ -import altair as alt -import numpy as np -import pandas as pd import streamlit as st # Dummy student database (replace with your database integration) @@ -26,7 +23,7 @@ def get_chatbot_response(user_input, students): if user_input.strip() == 'view students': return '\n'.join([f'{student}: {details["marks"]}' for student, details in students.items()]) else: - return str(chatbot.get_response(user_input)) + return "I'm sorry, I didn't understand that." # Streamlit UI st.title('Education System') From 4d91390076dae003038f4d3b3452406684659ddf Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:13:38 +0530 Subject: [PATCH 05/73] Update streamlit_app.py --- streamlit_app.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 29a6ff6ff753..752b4b7a263d 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,12 +1,24 @@ import streamlit as st -# Dummy student database (replace with your database integration) -students = { - 'Alice': {'marks': 85}, - 'Bob': {'marks': 70}, - 'Charlie': {'marks': 60} -} +import mysql.connector +# Establish database connection +conn = mysql.connector.connect( + host="localhost", + user="root", + password="recovery", + database="test" +) +cursor = conn.cursor() + +# Retrieve student information from database +cursor.execute("SELECT name, marks FROM students") +students = {name: {'marks': marks} for name, marks in cursor.fetchall()} + +# Function to add a new student to the database +def add_student(name, marks): + cursor.execute("INSERT INTO students (name, marks) VALUES (%s, %s)", (name, marks)) + conn.commit() # Function to check admission criteria def check_admission(student_name): if student_name in students: From aad673a08fd8783bce4082cdab0a2d55cc719627 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:15:32 +0530 Subject: [PATCH 06/73] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 502d7d1a0d19..69ff18026246 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ altair pandas streamlit +mysql-connector-python From 01fb70c1d467c98e6d03d3840ac16958492f5ed3 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:21:08 +0530 Subject: [PATCH 07/73] Update streamlit_app.py --- streamlit_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index 752b4b7a263d..8fdf69a75cbd 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -4,7 +4,7 @@ # Establish database connection conn = mysql.connector.connect( - host="localhost", + host="MySQL80", user="root", password="recovery", database="test" From e0dd6064510ce6cf95f5279da64404d26c2c9c5a Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:22:32 +0530 Subject: [PATCH 08/73] Update streamlit_app.py --- streamlit_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index 8fdf69a75cbd..752b4b7a263d 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -4,7 +4,7 @@ # Establish database connection conn = mysql.connector.connect( - host="MySQL80", + host="localhost", user="root", password="recovery", database="test" From 914615fdc1dec308b7290eafcdb4a23138d51d75 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 17:53:25 +0530 Subject: [PATCH 09/73] Update streamlit_app.py --- streamlit_app.py | 47 +++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 752b4b7a263d..d10afaf348d3 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,28 +1,23 @@ import streamlit as st +import pandas as pd -import mysql.connector +# Load student data from Excel file +try: + student_df = pd.read_excel("student_data.xlsx") +except FileNotFoundError: + student_df = pd.DataFrame(columns=["Name", "Marks"]) -# Establish database connection -conn = mysql.connector.connect( - host="localhost", - user="root", - password="recovery", - database="test" -) -cursor = conn.cursor() - -# Retrieve student information from database -cursor.execute("SELECT name, marks FROM students") -students = {name: {'marks': marks} for name, marks in cursor.fetchall()} - -# Function to add a new student to the database +# Function to add a new student to the DataFrame and Excel file def add_student(name, marks): - cursor.execute("INSERT INTO students (name, marks) VALUES (%s, %s)", (name, marks)) - conn.commit() + new_student = pd.DataFrame([[name, marks]], columns=["Name", "Marks"]) + student_df = student_df.append(new_student, ignore_index=True) + student_df.to_excel("student_data.xlsx", index=False) + # Function to check admission criteria def check_admission(student_name): - if student_name in students: - marks = students[student_name]['marks'] + student_row = student_df.loc[student_df["Name"] == student_name] + if not student_row.empty: + marks = student_row.iloc[0]["Marks"] if marks >= 75: return f"{student_name} is admitted!" else: @@ -30,13 +25,6 @@ def check_admission(student_name): else: return f"{student_name} is not found in the database." -# Function to handle chatbot responses -def get_chatbot_response(user_input, students): - if user_input.strip() == 'view students': - return '\n'.join([f'{student}: {details["marks"]}' for student, details in students.items()]) - else: - return "I'm sorry, I didn't understand that." - # Streamlit UI st.title('Education System') @@ -46,20 +34,19 @@ def get_chatbot_response(user_input, students): new_student_marks = st.number_input('Enter student marks:', min_value=0, max_value=100) if st.button('Add Student'): - students[new_student_name] = {'marks': new_student_marks} + add_student(new_student_name, new_student_marks) st.success(f'{new_student_name} added successfully!') # View existing students and marks st.subheader('Existing Students and Marks') -for student, details in students.items(): - st.write(f'{student}: {details["marks"]}') +st.write(student_df) # Chatbot interface st.subheader('Chat with EducationBot') user_input = st.text_input('You:') if st.button('Send'): - response = get_chatbot_response(user_input, students) + response = "I'm sorry, I didn't understand that." st.write('EducationBot:', response) # Admission checker From 698dc6ad8bda343e4cd4a2b7daa9f6c06bbc7467 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 17:59:51 +0530 Subject: [PATCH 10/73] Update streamlit_app.py --- streamlit_app.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index d10afaf348d3..60936986f37e 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,20 +1,22 @@ import streamlit as st import pandas as pd -# Load student data from Excel file -try: - student_df = pd.read_excel("student_data.xlsx") -except FileNotFoundError: - student_df = pd.DataFrame(columns=["Name", "Marks"]) +# Function to load student data from Excel file +def load_student_data(): + try: + return pd.read_excel("student_data.xlsx") + except FileNotFoundError: + return pd.DataFrame(columns=["Name", "Marks"]) # Function to add a new student to the DataFrame and Excel file -def add_student(name, marks): +def add_student(student_df, name, marks): new_student = pd.DataFrame([[name, marks]], columns=["Name", "Marks"]) student_df = student_df.append(new_student, ignore_index=True) student_df.to_excel("student_data.xlsx", index=False) + return student_df # Function to check admission criteria -def check_admission(student_name): +def check_admission(student_df, student_name): student_row = student_df.loc[student_df["Name"] == student_name] if not student_row.empty: marks = student_row.iloc[0]["Marks"] @@ -28,13 +30,16 @@ def check_admission(student_name): # Streamlit UI st.title('Education System') +# Load student data +student_df = load_student_data() + # Add new student form st.subheader('Add New Student') new_student_name = st.text_input('Enter student name:') new_student_marks = st.number_input('Enter student marks:', min_value=0, max_value=100) if st.button('Add Student'): - add_student(new_student_name, new_student_marks) + student_df = add_student(student_df, new_student_name, new_student_marks) st.success(f'{new_student_name} added successfully!') # View existing students and marks @@ -53,5 +58,5 @@ def check_admission(student_name): st.subheader('Admission Checker') admission_student = st.text_input('Enter student name to check admission:') if st.button('Check Admission'): - admission_result = check_admission(admission_student) + admission_result = check_admission(student_df, admission_student) st.write(admission_result) From d240b8654acfced4ac02d856c9121aeb1f2c6801 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:01:37 +0530 Subject: [PATCH 11/73] Update streamlit_app.py --- streamlit_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index 60936986f37e..7c9dd6d04d38 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -11,7 +11,7 @@ def load_student_data(): # Function to add a new student to the DataFrame and Excel file def add_student(student_df, name, marks): new_student = pd.DataFrame([[name, marks]], columns=["Name", "Marks"]) - student_df = student_df.append(new_student, ignore_index=True) + student_df = pd.concat([student_df, new_student], ignore_index=True) student_df.to_excel("student_data.xlsx", index=False) return student_df From 275559492b2e248fe2335739185d0d0e94d3fe15 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:03:22 +0530 Subject: [PATCH 12/73] Add files via upload --- student_data.xlsx | Bin 0 -> 4807 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 student_data.xlsx diff --git a/student_data.xlsx b/student_data.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..2c11b0e2e16e2f9736b4b0e38af21c53410901dd GIT binary patch literal 4807 zcmai22UL@55(Pq2B$UvbAVnbpK{_HO6cMDOVvt@!4^64kLXnQ4H|f17ARrKsA{_xy zj5LWfDS`q5ij+-o_sMhjxs!8}Kj-ATIdlKHGk1O+4FEA60XaE20Ro(CNN^&UaMxar z!d7nPo_5Y~_y1go2zfaU3_lM*QB_H=6-Z1O#S8+8SJGqORt|&&T|%_WJ*sBUAuR4sC-3bQ-M6)_rrfLDQZIgbS22riPl_vq!D5eO*9KcrN>-(NMQ5L|J0Mszk|V|! z|F|0TK=zc>A2am}&1cT@N9d`>?<)su&o!9pXpoVUS=b>-2nh(t00aa&|Bp&fgqwrAt+lm>yYTVH zPb%LGIOjv?NU`TrJr&-QDFsR>DvU*yEmxHli8^4U+9QQ~C4$fgOwfx&`uyox)x+QS z2kLt{WQNe(y6Nf3^{K9r_qM1r}4%@>=M{vt>RYrRs{SNLtAOL!;q@ zx$Zj5`o+}tcW7dt3Ok(p)UPEF8+~BlTjHRiBQ54iicxeSlg=Z`3^kax=$($W*gWUj z83BPS(}YFGJO;y7qq>_(diZbZ4PP2&-^F7sn89lM#k{Q(8=W9{7P$_7t=)DGS%qNQFDe*I zsK&_83G-7O^cZ=MiB;Zb7n)j+V0Gd-x;A7K(gyAWiVw|LpR<({8F{_$t$vHX)w8p*FkPxDr;&R*hQ!RW6KY-+Ua*@XRYb7iT!-)~M!{8P zpVB3agpvHW1}13{*n?NsqxohJ7B7q3vp`eNr7>xXs?J12fD%Ge2VYnTkW$cS36&X? z)IC?$E_~BUyL~gPQ^_@;eO4G>DOjG}@OfONTqF5YrEvcg-HA#ub+dLnSuaBP?=iy~ zr#m3jq*#zwIK(&MZRi8BHPsO3LJl*vA}U7?o{d+N88La-j)lQtzfMzeD$!cjP$_9} z?mP*krhmB)NINv`+5%tz!D4D_dCYUkHCxKG#4P(IT{Hcxn5%U=Qc*J$G-GO{+@6md zwR{-Q6v>7udKoaXsX0bkfIEr_w^RCHf?Q9Vh~El6I;=LH(T)Ua8B>mboeLcy{M=~B zCvql{$K`OMr4t2bP&STu9Jvj`b5L2bs#%N6PyolnKdS}wlLHT1YbR^r{)sz)rXe1MH4?Hwoha~@0O3t6XR@_ zm9h!xiwprp7NUeuPpPRPnfx)~A=LcXMV`%M)TmNoSm35oP7>9V4=u)rG_tLedO!|{ zv699S=fs^nQiTQT2F!DoTYwJVkGyilv#hf|ek_4V1r?DylkN9xB~W%bd8%e3-D+LbNnnw$>NuC!iJr2yI^EFXFvoLL=); z^&*vh`$27D%WDBakxPIvbNF=0^HuKB{8&A8s?7-0W2gqLv}R|^rIm<#_NY5N_J+ck z_Aa(n5p3grR{wlF7Ak1DN^ha7-$O*#s1trl%WbuQtrp?!C9t|Y#ZPw8sChy1UJ~^7 zZTQwsyu?=@1`7Sa$Jb1SI}9tp9qcqBo~GwJ>W2y~r1LDy<%@}!Z|IVdU~3${nG}*g zAke2xzFW4hJ$A*nuoyK?Imvtqv7A*o%1+aLZ#5E9Zyu~PDw*B*c3{D)G)tFxtIPKd z3*~3h{wC2cB}193;B*2;2d2{1>y)+7jZ+Ltfp!%f=YuLh2lA2{?V(fV4-Fs(rIGR) zydMIK(k51Im@hcgjSo%jJ)2E_+cUtn!kDH^b80@MFslqf-?xO33?8`VZ;(fI?Hl>} z(!--R0o}tXArMm$RAT&$zO&=HL{!UanOr2duPNq2zD1X&W#rN^e~?# z?slttgZAt z-0))_Ki#e4+HupJTKRd-k=a^{)Ym{AYt{($mYkbx*tS>d^${v);CoHtfH>VygTkI& zn?;C?drV6@#9htGys<=qYpnFt8<-S_oGB*9P*%KEJA}cx_lc`;*lmL}TB9Z9Fwe@y zb%>8i0bwbRJpWZ;68CcN-X+#`YTli_%Ceg>dkQ%#VkkqyAQt{Rs{39wqHLKoyKCGm zf`*s$OCfAN;fyH00u51oX6XFvuRA}^Xz@^3d#|}gJ@5DX4 z9j%Wut}|%=tG7JrYK|=9t6^W5ElJsluY3dUexgd)O(aqGW1BsCdU{ONo~~5x-C)Lt z7G@il?+}=hNg)->9hHWRVA^G3j|p~xJV@Ve)7-zc&pg^XeDeMx&9dFTPr!7pp8g!9&Ml?Q~t%iA# z=gg`GTIVD(Y^E>APKyZLzHkLw+>CDpohqnYDoeY{3&^UHd%mT*2(8 ztLH|6D3ZEmi#NWP3PG=`xD8^e@}$BeJd7=@2S(YQEN>yHkZBwuym0HHJ{`cgdecX@ z+xyo&cSWXkTSSAJ=F1Zb9(FlwU%B=&L+Nv!@3>O_oa3B$G_2rlJvFzXy1%#Frv<5I zeZhR6TTPQk57*0vleuLb=2cja^3IQo_0k_CuRqEyxMB~g8)%IJa=|4Zr6;r$%WEDS z3!z4)20ezWg(~7d34!WoJ>aLV1p?u4>~K*t_DBd_c(&PREEF-hwA3wN&mXOb=r)@K z6l@qOZCypZ8E=?*RW`V-dM}AhYbYgdKE;uh7s*lqQZ43zh4K)*)D-$E!fTrScmPf- zHS94|@G2ffAyxBo9fh#eCbQHc9CAoOjs6fQdb2@G=ML5n>ee!^u;9?}EvTw#bGt?4 z#k;J;B&XXI!gmYm_z`klmmDY@mQ8OP5Na4dnBM|cSs+cfcXm;CameJ~k7ON77zxz3 zmGXcNgSfgrGV$AJf3%P2JuL`?o(@<>t6tAS)sDFi8^*G%U60=FsY7*s;DZfswR#Uy zPGA3&v9u9TaG^l=D_NaQ146_!YU5$SqIvh(Wo}fAt8asthD_@!Mk0#?d7I)qkX9`x ztz$EPO(k{u-t$0nLMkwQ;-6&)9JKnFDQb#?m zAkn_d+A@Z4dAv}^V2bj0a5o12N8`-$^Tz!2Kqqg{u?wn1DcW~Js8zH_E2rfM}P!cxsDzROGVq9w4pa ztbtrnS8vqWTLAz(W68|z`YSj-8j1c?$`rU?{G{vOMo|$M4520&!5KxH9X%KG=-ekF ze2$bHIrU0h3dMHi9cycPF%&5Y-?#jWDpI^HsJ@zWf^&M^%xvkG+gS)PJLoF}6uL0M z^EDUDx(M#p@e51!r8-09pS96iAOq!8J?CXhIN;2e+-zSLamx>+sv@2x*e8;H7aHE3 zdd{kIKegf&kzYQA+1kpNvl&g!I$r1QX20q_OK%#%qk({&Hsm|xk$?Z7`(kceIVwQb zum$G}$;b;3xtuk)L@xZXi{pKwkrKk$!`j)y)WF-t+T9qh+&cXMEnHRX6CHAG(u+Gw zbB3hvw9S#LB~lrF(zF~C_MXPf)Lw(}lyL^VF+tb&TozreE8fbg?IH!GVZkE&J$VX` zgC+cLN5pk)EospuwmUp&x8&VXvyf{}7uumI#ad}6*}BE<>Y?mM2$Q(-;03@w#YJma zKe;`LMxx~0Mx{YJ{Hu4O5l|#U&Vte*BP!hgd0`dt3)`6B!B(Dxh*`THGeoWNfc(4@ zT24e%hKV0Ev3^FJZ*;qqApea3dh;bu{)Q=SZdDAF{mq1{`ZWFiO1_a|M()Nh)Y-=nE5(f>xuOc*GqtMPap53GMx(>Xl`W3Te#{mCjv3^H5Ij8XM Date: Mon, 22 Apr 2024 18:04:20 +0530 Subject: [PATCH 13/73] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 69ff18026246..36ef878899d6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ altair pandas streamlit mysql-connector-python +openpyxl From a4f448c7c53a12757acb20e77582887be00ce2f4 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:09:18 +0530 Subject: [PATCH 14/73] Update streamlit_app.py --- streamlit_app.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/streamlit_app.py b/streamlit_app.py index 7c9dd6d04d38..541e7294ee55 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -60,3 +60,8 @@ def check_admission(student_df, student_name): if st.button('Check Admission'): admission_result = check_admission(student_df, admission_student) st.write(admission_result) + +# Chat input functionality +prompt = st.text_input("Say something") +if prompt: + st.write(f"User has sent the following prompt: {prompt}") From e58104174eb57342c18fa31b07f46a196592b6cb Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:11:59 +0530 Subject: [PATCH 15/73] Update streamlit_app.py --- streamlit_app.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 541e7294ee55..2ad34758596d 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -23,7 +23,7 @@ def check_admission(student_df, student_name): if marks >= 75: return f"{student_name} is admitted!" else: - return f"{student_name} does not meet admission criteria." + return f"{student_name} does not meet admission criteria (marks < 75)." else: return f"{student_name} is not found in the database." @@ -38,9 +38,11 @@ def check_admission(student_df, student_name): new_student_name = st.text_input('Enter student name:') new_student_marks = st.number_input('Enter student marks:', min_value=0, max_value=100) -if st.button('Add Student'): +if st.button('Add Student') and new_student_marks >= 75: student_df = add_student(student_df, new_student_name, new_student_marks) st.success(f'{new_student_name} added successfully!') +elif st.button('Add Student') and new_student_marks < 75: + st.error("Marks should be 75 or greater for admission.") # View existing students and marks st.subheader('Existing Students and Marks') From d5bb6864c846e9269869b86e8ef2a02a35656c59 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:13:48 +0530 Subject: [PATCH 16/73] Update streamlit_app.py --- streamlit_app.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 2ad34758596d..1647f73a0f5b 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -35,13 +35,13 @@ def check_admission(student_df, student_name): # Add new student form st.subheader('Add New Student') -new_student_name = st.text_input('Enter student name:') -new_student_marks = st.number_input('Enter student marks:', min_value=0, max_value=100) +new_student_name = st.text_input('Enter student name:', key="new_student_name") +new_student_marks = st.number_input('Enter student marks:', min_value=0, max_value=100, key="new_student_marks") -if st.button('Add Student') and new_student_marks >= 75: +if st.button('Add Student', key="add_student_button") and new_student_marks >= 75: student_df = add_student(student_df, new_student_name, new_student_marks) st.success(f'{new_student_name} added successfully!') -elif st.button('Add Student') and new_student_marks < 75: +elif st.button('Add Student', key="add_student_button") and new_student_marks < 75: st.error("Marks should be 75 or greater for admission.") # View existing students and marks @@ -50,20 +50,20 @@ def check_admission(student_df, student_name): # Chatbot interface st.subheader('Chat with EducationBot') -user_input = st.text_input('You:') +user_input = st.text_input('You:', key="user_input") -if st.button('Send'): +if st.button('Send', key="send_button"): response = "I'm sorry, I didn't understand that." st.write('EducationBot:', response) # Admission checker st.subheader('Admission Checker') -admission_student = st.text_input('Enter student name to check admission:') -if st.button('Check Admission'): +admission_student = st.text_input('Enter student name to check admission:', key="admission_student") +if st.button('Check Admission', key="check_admission_button"): admission_result = check_admission(student_df, admission_student) st.write(admission_result) # Chat input functionality -prompt = st.text_input("Say something") +prompt = st.text_input("Say something", key="chat_prompt") if prompt: st.write(f"User has sent the following prompt: {prompt}") From ec5fcd426f6826116b536e88a235e590bac248be Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:16:10 +0530 Subject: [PATCH 17/73] Update streamlit_app.py --- streamlit_app.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 1647f73a0f5b..817294fa8361 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -38,10 +38,11 @@ def check_admission(student_df, student_name): new_student_name = st.text_input('Enter student name:', key="new_student_name") new_student_marks = st.number_input('Enter student marks:', min_value=0, max_value=100, key="new_student_marks") -if st.button('Add Student', key="add_student_button") and new_student_marks >= 75: +add_student_button_key = "add_student_button_" + new_student_name # Unique key for each student +if st.button('Add Student', key=add_student_button_key) and new_student_marks >= 75: student_df = add_student(student_df, new_student_name, new_student_marks) st.success(f'{new_student_name} added successfully!') -elif st.button('Add Student', key="add_student_button") and new_student_marks < 75: +elif st.button('Add Student', key=add_student_button_key) and new_student_marks < 75: st.error("Marks should be 75 or greater for admission.") # View existing students and marks @@ -52,14 +53,16 @@ def check_admission(student_df, student_name): st.subheader('Chat with EducationBot') user_input = st.text_input('You:', key="user_input") -if st.button('Send', key="send_button"): +send_button_key = "send_button_" + user_input # Unique key for each user input +if st.button('Send', key=send_button_key): response = "I'm sorry, I didn't understand that." st.write('EducationBot:', response) # Admission checker st.subheader('Admission Checker') admission_student = st.text_input('Enter student name to check admission:', key="admission_student") -if st.button('Check Admission', key="check_admission_button"): +check_admission_button_key = "check_admission_button_" + admission_student # Unique key for each admission check +if st.button('Check Admission', key=check_admission_button_key): admission_result = check_admission(student_df, admission_student) st.write(admission_result) From bafc9a87410c61c4dbb09c3c57d7964247d6c9d8 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:18:42 +0530 Subject: [PATCH 18/73] Update streamlit_app.py --- streamlit_app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 817294fa8361..c67dbb5786c6 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -38,7 +38,9 @@ def check_admission(student_df, student_name): new_student_name = st.text_input('Enter student name:', key="new_student_name") new_student_marks = st.number_input('Enter student marks:', min_value=0, max_value=100, key="new_student_marks") -add_student_button_key = "add_student_button_" + new_student_name # Unique key for each student +# Unique key for each student +add_student_button_key = "add_student_button_" + new_student_name + if st.button('Add Student', key=add_student_button_key) and new_student_marks >= 75: student_df = add_student(student_df, new_student_name, new_student_marks) st.success(f'{new_student_name} added successfully!') @@ -52,8 +54,8 @@ def check_admission(student_df, student_name): # Chatbot interface st.subheader('Chat with EducationBot') user_input = st.text_input('You:', key="user_input") - send_button_key = "send_button_" + user_input # Unique key for each user input + if st.button('Send', key=send_button_key): response = "I'm sorry, I didn't understand that." st.write('EducationBot:', response) @@ -62,6 +64,7 @@ def check_admission(student_df, student_name): st.subheader('Admission Checker') admission_student = st.text_input('Enter student name to check admission:', key="admission_student") check_admission_button_key = "check_admission_button_" + admission_student # Unique key for each admission check + if st.button('Check Admission', key=check_admission_button_key): admission_result = check_admission(student_df, admission_student) st.write(admission_result) From 43124aa9992f0802f67390eb0cd140e83d8dfbd0 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:21:01 +0530 Subject: [PATCH 19/73] Update streamlit_app.py --- streamlit_app.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index c67dbb5786c6..680df8d239dc 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -41,10 +41,10 @@ def check_admission(student_df, student_name): # Unique key for each student add_student_button_key = "add_student_button_" + new_student_name -if st.button('Add Student', key=add_student_button_key) and new_student_marks >= 75: +if st.button('Add Student', key1=add_student_button_key) and new_student_marks >= 75: student_df = add_student(student_df, new_student_name, new_student_marks) st.success(f'{new_student_name} added successfully!') -elif st.button('Add Student', key=add_student_button_key) and new_student_marks < 75: +elif st.button('Add Student', key1=add_student_button_key) and new_student_marks < 75: st.error("Marks should be 75 or greater for admission.") # View existing students and marks @@ -53,23 +53,24 @@ def check_admission(student_df, student_name): # Chatbot interface st.subheader('Chat with EducationBot') -user_input = st.text_input('You:', key="user_input") +user_input = st.text_input('You:', key2="user_input") send_button_key = "send_button_" + user_input # Unique key for each user input -if st.button('Send', key=send_button_key): +if st.button('Send', key3=send_button_key): response = "I'm sorry, I didn't understand that." st.write('EducationBot:', response) # Admission checker st.subheader('Admission Checker') -admission_student = st.text_input('Enter student name to check admission:', key="admission_student") +admission_student = st.text_input('Enter student name to check admission:', key4="admission_student") check_admission_button_key = "check_admission_button_" + admission_student # Unique key for each admission check -if st.button('Check Admission', key=check_admission_button_key): +if st.button('Check Admission', key5=check_admission_button_key): admission_result = check_admission(student_df, admission_student) st.write(admission_result) # Chat input functionality -prompt = st.text_input("Say something", key="chat_prompt") +prompt = st.text_input("Say something", key6 + ="chat_prompt") if prompt: st.write(f"User has sent the following prompt: {prompt}") From 52285c7d561d465276e861a69aafed101cf178fa Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:24:15 +0530 Subject: [PATCH 20/73] Update streamlit_app.py --- streamlit_app.py | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 680df8d239dc..8cf504a5d7af 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -38,14 +38,19 @@ def check_admission(student_df, student_name): new_student_name = st.text_input('Enter student name:', key="new_student_name") new_student_marks = st.number_input('Enter student marks:', min_value=0, max_value=100, key="new_student_marks") -# Unique key for each student -add_student_button_key = "add_student_button_" + new_student_name +# Use session state to generate unique keys +if "add_student_key_count" not in st.session_state: + st.session_state["add_student_key_count"] = 0 -if st.button('Add Student', key1=add_student_button_key) and new_student_marks >= 75: +add_student_button_key = f"add_student_button_{st.session_state['add_student_key_count']}" + +if st.button('Add Student', key=add_student_button_key) and new_student_marks >= 75: student_df = add_student(student_df, new_student_name, new_student_marks) st.success(f'{new_student_name} added successfully!') -elif st.button('Add Student', key1=add_student_button_key) and new_student_marks < 75: + st.session_state["add_student_key_count"] += 1 +elif st.button('Add Student', key=add_student_button_key) and new_student_marks < 75: st.error("Marks should be 75 or greater for admission.") + st.session_state["add_student_key_count"] += 1 # View existing students and marks st.subheader('Existing Students and Marks') @@ -53,24 +58,35 @@ def check_admission(student_df, student_name): # Chatbot interface st.subheader('Chat with EducationBot') -user_input = st.text_input('You:', key2="user_input") -send_button_key = "send_button_" + user_input # Unique key for each user input +user_input = st.text_input('You:', key="user_input") + +# Use session state to generate unique keys +if "send_button_key_count" not in st.session_state: + st.session_state["send_button_key_count"] = 0 + +send_button_key = f"send_button_{st.session_state['send_button_key_count']}" -if st.button('Send', key3=send_button_key): +if st.button('Send', key=send_button_key): response = "I'm sorry, I didn't understand that." st.write('EducationBot:', response) + st.session_state["send_button_key_count"] += 1 # Admission checker st.subheader('Admission Checker') -admission_student = st.text_input('Enter student name to check admission:', key4="admission_student") -check_admission_button_key = "check_admission_button_" + admission_student # Unique key for each admission check +admission_student = st.text_input('Enter student name to check admission:', key="admission_student") + +# Use session state to generate unique keys +if "check_admission_key_count" not in st.session_state: + st.session_state["check_admission_key_count"] = 0 + +check_admission_button_key = f"check_admission_button_{st.session_state['check_admission_key_count']}" -if st.button('Check Admission', key5=check_admission_button_key): +if st.button('Check Admission', key=check_admission_button_key): admission_result = check_admission(student_df, admission_student) st.write(admission_result) + st.session_state["check_admission_key_count"] += 1 # Chat input functionality -prompt = st.text_input("Say something", key6 - ="chat_prompt") +prompt = st.text_input("Say something", key="chat_prompt") if prompt: st.write(f"User has sent the following prompt: {prompt}") From 2bdc9347927adfc49d954b28bd680405cd9b72f8 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:25:59 +0530 Subject: [PATCH 21/73] Update streamlit_app.py --- streamlit_app.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 8cf504a5d7af..8b9a53c8d50c 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -35,8 +35,8 @@ def check_admission(student_df, student_name): # Add new student form st.subheader('Add New Student') -new_student_name = st.text_input('Enter student name:', key="new_student_name") -new_student_marks = st.number_input('Enter student marks:', min_value=0, max_value=100, key="new_student_marks") +new_student_name = st.text_input('Enter student name:') +new_student_marks = st.text_input('Enter student marks:') # Use session state to generate unique keys if "add_student_key_count" not in st.session_state: @@ -44,12 +44,16 @@ def check_admission(student_df, student_name): add_student_button_key = f"add_student_button_{st.session_state['add_student_key_count']}" -if st.button('Add Student', key=add_student_button_key) and new_student_marks >= 75: - student_df = add_student(student_df, new_student_name, new_student_marks) - st.success(f'{new_student_name} added successfully!') - st.session_state["add_student_key_count"] += 1 -elif st.button('Add Student', key=add_student_button_key) and new_student_marks < 75: - st.error("Marks should be 75 or greater for admission.") +if st.button('Add Student', key=add_student_button_key): + try: + marks = int(new_student_marks) + if marks >= 75: + student_df = add_student(student_df, new_student_name, marks) + st.success(f'{new_student_name} added successfully!') + else: + st.error("Marks should be 75 or greater for admission.") + except ValueError: + st.error("Please enter a valid integer for marks.") st.session_state["add_student_key_count"] += 1 # View existing students and marks @@ -58,7 +62,7 @@ def check_admission(student_df, student_name): # Chatbot interface st.subheader('Chat with EducationBot') -user_input = st.text_input('You:', key="user_input") +user_input = st.text_input('You:') # Use session state to generate unique keys if "send_button_key_count" not in st.session_state: @@ -73,7 +77,7 @@ def check_admission(student_df, student_name): # Admission checker st.subheader('Admission Checker') -admission_student = st.text_input('Enter student name to check admission:', key="admission_student") +admission_student = st.text_input('Enter student name to check admission:') # Use session state to generate unique keys if "check_admission_key_count" not in st.session_state: @@ -87,6 +91,6 @@ def check_admission(student_df, student_name): st.session_state["check_admission_key_count"] += 1 # Chat input functionality -prompt = st.text_input("Say something", key="chat_prompt") +prompt = st.text_input("Say something") if prompt: st.write(f"User has sent the following prompt: {prompt}") From f44e9f082fc62052df3c91b4a0b99056bb7d76c9 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:31:40 +0530 Subject: [PATCH 22/73] Update streamlit_app.py --- streamlit_app.py | 84 ++++++++++++++++-------------------------------- 1 file changed, 28 insertions(+), 56 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 8b9a53c8d50c..dad0bf160379 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -27,70 +27,42 @@ def check_admission(student_df, student_name): else: return f"{student_name} is not found in the database." +# Chatbot function +def chatbot(student_df, query): + if "view students" in query.lower(): + return student_df.to_markdown() + elif "add student" in query.lower(): + name = input("Enter student name: ") + marks = input("Enter student marks: ") + try: + marks = int(marks) + if marks >= 75: + student_df = add_student(student_df, name, marks) + return f"{name} added successfully!" + else: + return "Marks should be 75 or greater for admission." + except ValueError: + return "Please enter a valid integer for marks." + elif "check admission" in query.lower(): + name = input("Enter student name to check admission: ") + return check_admission(student_df, name) + else: + return "I'm sorry, I didn't understand that query." + # Streamlit UI st.title('Education System') # Load student data student_df = load_student_data() -# Add new student form -st.subheader('Add New Student') -new_student_name = st.text_input('Enter student name:') -new_student_marks = st.text_input('Enter student marks:') - -# Use session state to generate unique keys -if "add_student_key_count" not in st.session_state: - st.session_state["add_student_key_count"] = 0 - -add_student_button_key = f"add_student_button_{st.session_state['add_student_key_count']}" - -if st.button('Add Student', key=add_student_button_key): - try: - marks = int(new_student_marks) - if marks >= 75: - student_df = add_student(student_df, new_student_name, marks) - st.success(f'{new_student_name} added successfully!') - else: - st.error("Marks should be 75 or greater for admission.") - except ValueError: - st.error("Please enter a valid integer for marks.") - st.session_state["add_student_key_count"] += 1 - -# View existing students and marks -st.subheader('Existing Students and Marks') -st.write(student_df) - # Chatbot interface st.subheader('Chat with EducationBot') user_input = st.text_input('You:') -# Use session state to generate unique keys -if "send_button_key_count" not in st.session_state: - st.session_state["send_button_key_count"] = 0 - -send_button_key = f"send_button_{st.session_state['send_button_key_count']}" - -if st.button('Send', key=send_button_key): - response = "I'm sorry, I didn't understand that." - st.write('EducationBot:', response) - st.session_state["send_button_key_count"] += 1 - -# Admission checker -st.subheader('Admission Checker') -admission_student = st.text_input('Enter student name to check admission:') - -# Use session state to generate unique keys -if "check_admission_key_count" not in st.session_state: - st.session_state["check_admission_key_count"] = 0 +if st.button('Send'): + response = chatbot(student_df, user_input) + st.markdown(response) -check_admission_button_key = f"check_admission_button_{st.session_state['check_admission_key_count']}" - -if st.button('Check Admission', key=check_admission_button_key): - admission_result = check_admission(student_df, admission_student) - st.write(admission_result) - st.session_state["check_admission_key_count"] += 1 - -# Chat input functionality -prompt = st.text_input("Say something") -if prompt: - st.write(f"User has sent the following prompt: {prompt}") +# View existing students and marks +st.subheader('Existing Students and Marks') +st.write(student_df) From 8c5f0dc676daa0373a37373547848d8a5f159427 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:33:09 +0530 Subject: [PATCH 23/73] Update streamlit_app.py --- streamlit_app.py | 58 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index dad0bf160379..a59f55273c38 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -55,14 +55,64 @@ def chatbot(student_df, query): # Load student data student_df = load_student_data() +# Add new student form +st.subheader('Add New Student') +new_student_name = st.text_input('Enter student name:') +new_student_marks = st.text_input('Enter student marks:') + +# Use session state to generate unique keys +if "add_student_key_count" not in st.session_state: + st.session_state["add_student_key_count"] = 0 + +add_student_button_key = f"add_student_button_{st.session_state['add_student_key_count']}" + +if st.button('Add Student', key=add_student_button_key): + try: + marks = int(new_student_marks) + if marks >= 75: + student_df = add_student(student_df, new_student_name, marks) + st.success(f'{new_student_name} added successfully!') + else: + st.error("Marks should be 75 or greater for admission.") + except ValueError: + st.error("Please enter a valid integer for marks.") + st.session_state["add_student_key_count"] += 1 + +# View existing students and marks +st.subheader('Existing Students and Marks') +st.write(student_df) + # Chatbot interface st.subheader('Chat with EducationBot') user_input = st.text_input('You:') -if st.button('Send'): +# Use session state to generate unique keys +if "send_button_key_count" not in st.session_state: + st.session_state["send_button_key_count"] = 0 + +send_button_key = f"send_button_{st.session_state['send_button_key_count']}" + +if st.button('Send', key=send_button_key): response = chatbot(student_df, user_input) st.markdown(response) + st.session_state["send_button_key_count"] += 1 -# View existing students and marks -st.subheader('Existing Students and Marks') -st.write(student_df) +# Admission checker +st.subheader('Admission Checker') +admission_student = st.text_input('Enter student name to check admission:') + +# Use session state to generate unique keys +if "check_admission_key_count" not in st.session_state: + st.session_state["check_admission_key_count"] = 0 + +check_admission_button_key = f"check_admission_button_{st.session_state['check_admission_key_count']}" + +if st.button('Check Admission', key=check_admission_button_key): + admission_result = check_admission(student_df, admission_student) + st.write(admission_result) + st.session_state["check_admission_key_count"] += 1 + +# Chat input functionality +prompt = st.text_input("Say something") +if prompt: + st.write(f"User has sent the following prompt: {prompt}") From 03d157173f72d6e291c041005902dd8e8d8bc350 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:35:00 +0530 Subject: [PATCH 24/73] Update streamlit_app.py --- streamlit_app.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index a59f55273c38..aee63a1ace31 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -32,10 +32,11 @@ def chatbot(student_df, query): if "view students" in query.lower(): return student_df.to_markdown() elif "add student" in query.lower(): - name = input("Enter student name: ") - marks = input("Enter student marks: ") + st.subheader("Add New Student") + name = st.text_input("Enter student name:") + marks_str = st.text_input("Enter student marks:") try: - marks = int(marks) + marks = int(marks_str) if marks >= 75: student_df = add_student(student_df, name, marks) return f"{name} added successfully!" @@ -44,7 +45,8 @@ def chatbot(student_df, query): except ValueError: return "Please enter a valid integer for marks." elif "check admission" in query.lower(): - name = input("Enter student name to check admission: ") + st.subheader("Admission Checker") + name = st.text_input("Enter student name to check admission:") return check_admission(student_df, name) else: return "I'm sorry, I didn't understand that query." From 057196cd33fb545881a02c9a06a210591c231697 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:38:34 +0530 Subject: [PATCH 25/73] Update streamlit_app.py --- streamlit_app.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index aee63a1ace31..b23c40d2f9e8 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -26,6 +26,10 @@ def check_admission(student_df, student_name): return f"{student_name} does not meet admission criteria (marks < 75)." else: return f"{student_name} is not found in the database." + +# Chatbot interface +st.subheader('Chat with EducationBot') +user_input = st.text_input('You:') # Chatbot function def chatbot(student_df, query): @@ -84,9 +88,6 @@ def chatbot(student_df, query): st.subheader('Existing Students and Marks') st.write(student_df) -# Chatbot interface -st.subheader('Chat with EducationBot') -user_input = st.text_input('You:') # Use session state to generate unique keys if "send_button_key_count" not in st.session_state: From 6325baf5f8b4f4151f290b10b506fd98254849c5 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:41:52 +0530 Subject: [PATCH 26/73] Update streamlit_app.py --- streamlit_app.py | 63 +++++------------------------------------------- 1 file changed, 6 insertions(+), 57 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index b23c40d2f9e8..d2e742fcee0d 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -26,10 +26,6 @@ def check_admission(student_df, student_name): return f"{student_name} does not meet admission criteria (marks < 75)." else: return f"{student_name} is not found in the database." - -# Chatbot interface -st.subheader('Chat with EducationBot') -user_input = st.text_input('You:') # Chatbot function def chatbot(student_df, query): @@ -61,61 +57,14 @@ def chatbot(student_df, query): # Load student data student_df = load_student_data() -# Add new student form -st.subheader('Add New Student') -new_student_name = st.text_input('Enter student name:') -new_student_marks = st.text_input('Enter student marks:') - -# Use session state to generate unique keys -if "add_student_key_count" not in st.session_state: - st.session_state["add_student_key_count"] = 0 - -add_student_button_key = f"add_student_button_{st.session_state['add_student_key_count']}" +# Chatbot interface +st.subheader('Chat with EducationBot') +user_input = st.text_input('You:') -if st.button('Add Student', key=add_student_button_key): - try: - marks = int(new_student_marks) - if marks >= 75: - student_df = add_student(student_df, new_student_name, marks) - st.success(f'{new_student_name} added successfully!') - else: - st.error("Marks should be 75 or greater for admission.") - except ValueError: - st.error("Please enter a valid integer for marks.") - st.session_state["add_student_key_count"] += 1 +if st.button('Send'): + response = chatbot(student_df, user_input) + st.markdown(response) # View existing students and marks st.subheader('Existing Students and Marks') st.write(student_df) - - -# Use session state to generate unique keys -if "send_button_key_count" not in st.session_state: - st.session_state["send_button_key_count"] = 0 - -send_button_key = f"send_button_{st.session_state['send_button_key_count']}" - -if st.button('Send', key=send_button_key): - response = chatbot(student_df, user_input) - st.markdown(response) - st.session_state["send_button_key_count"] += 1 - -# Admission checker -st.subheader('Admission Checker') -admission_student = st.text_input('Enter student name to check admission:') - -# Use session state to generate unique keys -if "check_admission_key_count" not in st.session_state: - st.session_state["check_admission_key_count"] = 0 - -check_admission_button_key = f"check_admission_button_{st.session_state['check_admission_key_count']}" - -if st.button('Check Admission', key=check_admission_button_key): - admission_result = check_admission(student_df, admission_student) - st.write(admission_result) - st.session_state["check_admission_key_count"] += 1 - -# Chat input functionality -prompt = st.text_input("Say something") -if prompt: - st.write(f"User has sent the following prompt: {prompt}") From f4177224a46f4e762e92f74bf4c65f9ed718a23a Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:48:21 +0530 Subject: [PATCH 27/73] Update streamlit_app.py --- streamlit_app.py | 83 +++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 47 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index d2e742fcee0d..9caf3ca68b76 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -3,53 +3,29 @@ # Function to load student data from Excel file def load_student_data(): - try: - return pd.read_excel("student_data.xlsx") - except FileNotFoundError: - return pd.DataFrame(columns=["Name", "Marks"]) + try: + return pd.read_excel("student_data.xlsx") + except FileNotFoundError: + return pd.DataFrame(columns=["Name", "Marks"]) # Function to add a new student to the DataFrame and Excel file def add_student(student_df, name, marks): - new_student = pd.DataFrame([[name, marks]], columns=["Name", "Marks"]) - student_df = pd.concat([student_df, new_student], ignore_index=True) - student_df.to_excel("student_data.xlsx", index=False) - return student_df + new_student = pd.DataFrame([[name, marks]], columns=["Name", "Marks"]) + student_df = pd.concat([student_df, new_student], ignore_index=True) + student_df.to_excel("student_data.xlsx", index=False) + return student_df # Function to check admission criteria def check_admission(student_df, student_name): - student_row = student_df.loc[student_df["Name"] == student_name] - if not student_row.empty: - marks = student_row.iloc[0]["Marks"] - if marks >= 75: - return f"{student_name} is admitted!" - else: - return f"{student_name} does not meet admission criteria (marks < 75)." + student_row = student_df.loc[student_df["Name"] == student_name] + if not student_row.empty: + marks = student_row.iloc[0]["Marks"] + if marks >= 75: + return f"{student_name} is admitted!" else: - return f"{student_name} is not found in the database." - -# Chatbot function -def chatbot(student_df, query): - if "view students" in query.lower(): - return student_df.to_markdown() - elif "add student" in query.lower(): - st.subheader("Add New Student") - name = st.text_input("Enter student name:") - marks_str = st.text_input("Enter student marks:") - try: - marks = int(marks_str) - if marks >= 75: - student_df = add_student(student_df, name, marks) - return f"{name} added successfully!" - else: - return "Marks should be 75 or greater for admission." - except ValueError: - return "Please enter a valid integer for marks." - elif "check admission" in query.lower(): - st.subheader("Admission Checker") - name = st.text_input("Enter student name to check admission:") - return check_admission(student_df, name) - else: - return "I'm sorry, I didn't understand that query." + return f"{student_name} does not meet admission criteria (marks < 75)." + else: + return f"{student_name} is not found in the database." # Streamlit UI st.title('Education System') @@ -57,13 +33,26 @@ def chatbot(student_df, query): # Load student data student_df = load_student_data() -# Chatbot interface -st.subheader('Chat with EducationBot') -user_input = st.text_input('You:') - -if st.button('Send'): - response = chatbot(student_df, user_input) - st.markdown(response) +# Add Student Section +st.subheader('Add New Student') +name = st.text_input("Enter student name:") +marks_str = st.text_input("Enter student marks:") + +try: + marks = int(marks_str) + if st.button('Add Student'): # Button click to add student + student_df = add_student(student_df, name, marks) + st.success(f"{name} added successfully!") +except ValueError: + st.error("Please enter a valid integer for marks.") + +# Check Admission Section +st.subheader('Admission Checker') +name = st.text_input("Enter student name to check admission:") + +if st.button('Check Admission'): # Button click to check admission + admission_status = check_admission(student_df, name) + st.write(admission_status) # View existing students and marks st.subheader('Existing Students and Marks') From 8cd5e3ea6a6aaa123e76639dd5d035d9c606689d Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:50:49 +0530 Subject: [PATCH 28/73] Update streamlit_app.py --- streamlit_app.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 9caf3ca68b76..e4e1724becea 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -10,10 +10,13 @@ def load_student_data(): # Function to add a new student to the DataFrame and Excel file def add_student(student_df, name, marks): - new_student = pd.DataFrame([[name, marks]], columns=["Name", "Marks"]) - student_df = pd.concat([student_df, new_student], ignore_index=True) - student_df.to_excel("student_data.xlsx", index=False) - return student_df + if marks >= 75: # Check marks before adding + new_student = pd.DataFrame([[name, marks]], columns=["Name", "Marks"]) + student_df = pd.concat([student_df, new_student], ignore_index=True) + student_df.to_excel("student_data.xlsx", index=False) + return student_df + else: + return student_df # Don't add if marks < 75 # Function to check admission criteria def check_admission(student_df, student_name): @@ -30,7 +33,7 @@ def check_admission(student_df, student_name): # Streamlit UI st.title('Education System') -# Load student data +# Load student data (hidden) student_df = load_student_data() # Add Student Section @@ -42,7 +45,10 @@ def check_admission(student_df, student_name): marks = int(marks_str) if st.button('Add Student'): # Button click to add student student_df = add_student(student_df, name, marks) - st.success(f"{name} added successfully!") + if marks >= 75: + st.success(f"{name} added successfully!") + else: + st.warning(f"Student {name} not added. Marks should be 75 or greater for admission.") except ValueError: st.error("Please enter a valid integer for marks.") @@ -54,6 +60,4 @@ def check_admission(student_df, student_name): admission_status = check_admission(student_df, name) st.write(admission_status) -# View existing students and marks -st.subheader('Existing Students and Marks') -st.write(student_df) +# **Removed:** We removed the line `st.write(student_df)` to hide the data display From 17c56e9c4aa304fc3e403113cb584ca51454648c Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:53:35 +0530 Subject: [PATCH 29/73] Create home.py --- home.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 home.py diff --git a/home.py b/home.py new file mode 100644 index 000000000000..b4ee41e20c1e --- /dev/null +++ b/home.py @@ -0,0 +1,28 @@ +import streamlit as st + +def display_homepage(): + st.title("Welcome to the Education System!") + st.write("This platform allows you to manage student data and check admission eligibility.") + + # Button with HTML and CSS for styling (replace "#" with your actual path) + button_html = """ + + + """ + st.write(button_html, unsafe_allow_html=True) + +if __name__ == "__main__": + display_homepage() From 5bf5adbbf187b03fcce814e826a7755ee4059530 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:08:10 +0530 Subject: [PATCH 30/73] Update streamlit_app.py --- streamlit_app.py | 69 +++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index e4e1724becea..f9482f0434f0 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -3,32 +3,32 @@ # Function to load student data from Excel file def load_student_data(): - try: - return pd.read_excel("student_data.xlsx") - except FileNotFoundError: - return pd.DataFrame(columns=["Name", "Marks"]) + try: + return pd.read_excel("student_data.xlsx") + except FileNotFoundError: + return pd.DataFrame(columns=["Name", "Marks"]) # Function to add a new student to the DataFrame and Excel file def add_student(student_df, name, marks): - if marks >= 75: # Check marks before adding - new_student = pd.DataFrame([[name, marks]], columns=["Name", "Marks"]) - student_df = pd.concat([student_df, new_student], ignore_index=True) - student_df.to_excel("student_data.xlsx", index=False) - return student_df - else: - return student_df # Don't add if marks < 75 + if marks >= 75: # Check marks before adding + new_student = pd.DataFrame([[name, marks]], columns=["Name", "Marks"]) + student_df = pd.concat([student_df, new_student], ignore_index=True) + student_df.to_excel("student_data.xlsx", index=False) + return student_df + else: + return student_df # Don't add if marks < 75 # Function to check admission criteria def check_admission(student_df, student_name): - student_row = student_df.loc[student_df["Name"] == student_name] - if not student_row.empty: - marks = student_row.iloc[0]["Marks"] - if marks >= 75: - return f"{student_name} is admitted!" + student_row = student_df.loc[student_df["Name"] == student_name] + if not student_row.empty: + marks = student_row.iloc[0]["Marks"] + if marks >= 75: + return f"{student_name} is admitted!" + else: + return f"{student_name} does not meet admission criteria (marks < 75)." else: - return f"{student_name} does not meet admission criteria (marks < 75)." - else: - return f"{student_name} is not found in the database." + return f"{student_name} is not found in the database." # Streamlit UI st.title('Education System') @@ -42,22 +42,31 @@ def check_admission(student_df, student_name): marks_str = st.text_input("Enter student marks:") try: - marks = int(marks_str) - if st.button('Add Student'): # Button click to add student - student_df = add_student(student_df, name, marks) - if marks >= 75: - st.success(f"{name} added successfully!") - else: - st.warning(f"Student {name} not added. Marks should be 75 or greater for admission.") + marks = int(marks_str) + if st.button('Add Student'): # Button click to add student + student_df = add_student(student_df, name, marks) + if marks >= 75: + st.success(f"{name} added successfully!") + else: + st.warning(f"Student {name} not added. Marks should be 75 or greater for admission.") except ValueError: - st.error("Please enter a valid integer for marks.") + st.error("Please enter a valid integer for marks.") # Check Admission Section st.subheader('Admission Checker') name = st.text_input("Enter student name to check admission:") if st.button('Check Admission'): # Button click to check admission - admission_status = check_admission(student_df, name) - st.write(admission_status) + admission_status = check_admission(student_df, name) + st.write(admission_status) + +def display_homepage(): + st.title("Welcome to the Education System!") + st.write("This platform allows you to manage student data and check admission eligibility.") + + # Button to manage students + if st.button("Manage Students"): + st.write(student_df) # Display student data -# **Removed:** We removed the line `st.write(student_df)` to hide the data display +if __name__ == "__main__": + display_homepage() From 622606b98222b68b9484f661d5f48edf8a11d278 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:11:55 +0530 Subject: [PATCH 31/73] Update streamlit_app.py\ --- streamlit_app.py | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index f9482f0434f0..10ccd5116d7e 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -37,36 +37,20 @@ def check_admission(student_df, student_name): student_df = load_student_data() # Add Student Section -st.subheader('Add New Student') -name = st.text_input("Enter student name:") -marks_str = st.text_input("Enter student marks:") - -try: - marks = int(marks_str) - if st.button('Add Student'): # Button click to add student - student_df = add_student(student_df, name, marks) - if marks >= 75: - st.success(f"{name} added successfully!") - else: - st.warning(f"Student {name} not added. Marks should be 75 or greater for admission.") -except ValueError: - st.error("Please enter a valid integer for marks.") - -# Check Admission Section -st.subheader('Admission Checker') -name = st.text_input("Enter student name to check admission:") - -if st.button('Check Admission'): # Button click to check admission - admission_status = check_admission(student_df, name) - st.write(admission_status) - -def display_homepage(): - st.title("Welcome to the Education System!") - st.write("This platform allows you to manage student data and check admission eligibility.") +st.sidebar.title('Navigation') +page = st.sidebar.radio("Go to", ('Home', 'Admission Checker')) +if page == 'Home': + st.subheader('Home Page') + st.write("Welcome to the Education System! This platform allows you to manage student data and check admission eligibility.") + # Button to manage students if st.button("Manage Students"): st.write(student_df) # Display student data +elif page == 'Admission Checker': + st.subheader('Admission Checker') + name = st.text_input("Enter student name to check admission:") -if __name__ == "__main__": - display_homepage() + if st.button('Check Admission'): # Button click to check admission + admission_status = check_admission(student_df, name) + st.write(admission_status) From f3946cf416a0b8317360d15ad469b2bfdbdc4df9 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:14:48 +0530 Subject: [PATCH 32/73] Update streamlit_app.py --- streamlit_app.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 10ccd5116d7e..45713da5a43d 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -36,9 +36,8 @@ def check_admission(student_df, student_name): # Load student data (hidden) student_df = load_student_data() -# Add Student Section -st.sidebar.title('Navigation') -page = st.sidebar.radio("Go to", ('Home', 'Admission Checker')) +# Sidebar navigation +page = st.sidebar.radio("Navigation", ('Home', 'Add Student', 'Admission Checker')) if page == 'Home': st.subheader('Home Page') @@ -47,6 +46,23 @@ def check_admission(student_df, student_name): # Button to manage students if st.button("Manage Students"): st.write(student_df) # Display student data + +elif page == 'Add Student': + st.subheader('Add New Student') + name = st.text_input("Enter student name:") + marks_str = st.text_input("Enter student marks:") + + try: + marks = int(marks_str) + if st.button('Add Student'): # Button click to add student + student_df = add_student(student_df, name, marks) + if marks >= 75: + st.success(f"{name} added successfully!") + else: + st.warning(f"Student {name} not added. Marks should be 75 or greater for admission.") + except ValueError: + st.error("Please enter a valid integer for marks.") + elif page == 'Admission Checker': st.subheader('Admission Checker') name = st.text_input("Enter student name to check admission:") From 7cd83e9ee1cc9241132dec7e0cd883b23d84f6f4 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:16:08 +0530 Subject: [PATCH 33/73] Delete home.py --- home.py | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 home.py diff --git a/home.py b/home.py deleted file mode 100644 index b4ee41e20c1e..000000000000 --- a/home.py +++ /dev/null @@ -1,28 +0,0 @@ -import streamlit as st - -def display_homepage(): - st.title("Welcome to the Education System!") - st.write("This platform allows you to manage student data and check admission eligibility.") - - # Button with HTML and CSS for styling (replace "#" with your actual path) - button_html = """ - - - """ - st.write(button_html, unsafe_allow_html=True) - -if __name__ == "__main__": - display_homepage() From 07a5ed8927c8e5349b958460c9e3dda6b85971ca Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:18:52 +0530 Subject: [PATCH 34/73] Update streamlit_app.py --- streamlit_app.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 45713da5a43d..4e43cd2c51ec 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -40,9 +40,18 @@ def check_admission(student_df, student_name): page = st.sidebar.radio("Navigation", ('Home', 'Add Student', 'Admission Checker')) if page == 'Home': - st.subheader('Home Page') - st.write("Welcome to the Education System! This platform allows you to manage student data and check admission eligibility.") + st.subheader('Welcome to the Education System!') + st.markdown(""" + This platform allows you to manage student data and check admission eligibility. + **To get started, you can:** + - Click on **Manage Students** to view student data. + - Click on **Add Student** to add new students. + - Click on **Admission Checker** to check admission eligibility. + """) + + # Image or additional information can be added here for a more visually appealing layout + # Button to manage students if st.button("Manage Students"): st.write(student_df) # Display student data From ee5349be5d89a4ffcfd50b80d8ed004a8caf0579 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:21:45 +0530 Subject: [PATCH 35/73] Update streamlit_app.py --- streamlit_app.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index 4e43cd2c51ec..3ac309166bf1 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -30,6 +30,17 @@ def check_admission(student_df, student_name): else: return f"{student_name} is not found in the database." +# Function to filter students by course eligibility +def filter_students_by_course(student_df, course): + if course == "Science": + return student_df[student_df["Marks"] >= 80] + elif course == "Economics": + return student_df[student_df["Marks"] >= 75] + elif course == "Humanities": + return student_df[student_df["Marks"] >= 70] + else: + return pd.DataFrame(columns=["Name", "Marks"]) # Return empty DataFrame if course is not recognized + # Streamlit UI st.title('Education System') @@ -37,7 +48,7 @@ def check_admission(student_df, student_name): student_df = load_student_data() # Sidebar navigation -page = st.sidebar.radio("Navigation", ('Home', 'Add Student', 'Admission Checker')) +page = st.sidebar.radio("Navigation", ('Home', 'Add Student', 'Admission Checker', 'Course Eligibility')) if page == 'Home': st.subheader('Welcome to the Education System!') @@ -48,6 +59,7 @@ def check_admission(student_df, student_name): - Click on **Manage Students** to view student data. - Click on **Add Student** to add new students. - Click on **Admission Checker** to check admission eligibility. + - Click on **Course Eligibility** to see which students are eligible for specific courses. """) # Image or additional information can be added here for a more visually appealing layout @@ -79,3 +91,11 @@ def check_admission(student_df, student_name): if st.button('Check Admission'): # Button click to check admission admission_status = check_admission(student_df, name) st.write(admission_status) + +elif page == 'Course Eligibility': + st.subheader('Course Eligibility') + course = st.selectbox("Select a course:", ["Science", "Economics", "Humanities"]) + + st.write(f"Students eligible for {course} course:") + eligible_students = filter_students_by_course(student_df, course) + st.write(eligible_students) From a21377c55acc324a5e3cdb8533a04aac04c5f518 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:24:49 +0530 Subject: [PATCH 36/73] Update streamlit_app.py --- streamlit_app.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/streamlit_app.py b/streamlit_app.py index 3ac309166bf1..64f522e25567 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,6 +1,19 @@ import streamlit as st import pandas as pd +# Custom CSS style to make all pages red except for the text +custom_css = """ + +""" +st.markdown(custom_css, unsafe_allow_html=True) + # Function to load student data from Excel file def load_student_data(): try: From 53195e6262e52275919ef02d76cc91a416603deb Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:25:32 +0530 Subject: [PATCH 37/73] Update streamlit_app.py From e51d61efb2b59195f3a36e4e2cdc16bf64f7f47c Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:26:39 +0530 Subject: [PATCH 38/73] Update streamlit_app.py --- streamlit_app.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 64f522e25567..1dcb1ad0b71f 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -6,8 +6,6 @@ @@ -66,14 +64,15 @@ def filter_students_by_course(student_df, course): if page == 'Home': st.subheader('Welcome to the Education System!') st.markdown(""" - This platform allows you to manage student data and check admission eligibility. - - **To get started, you can:** - - Click on **Manage Students** to view student data. - - Click on **Add Student** to add new students. - - Click on **Admission Checker** to check admission eligibility. - - Click on **Course Eligibility** to see which students are eligible for specific courses. - """) +

This platform allows you to manage student data and check admission eligibility.

+

To get started, you can:

+
    +
  • Click on Manage Students to view student data.
  • +
  • Click on Add Student to add new students.
  • +
  • Click on Admission Checker to check admission eligibility.
  • +
  • Click on Course Eligibility to see which students are eligible for specific courses.
  • +
+ """, unsafe_allow_html=True) # Image or additional information can be added here for a more visually appealing layout From 3d0ba2f3b4f3fcb572b4672a1e9493a2d0cbe105 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:27:57 +0530 Subject: [PATCH 39/73] Update streamlit_app.py --- streamlit_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index 1dcb1ad0b71f..5412c62741f7 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,6 +1,6 @@ import streamlit as st import pandas as pd - +st.set_page_config(page_title="Education System", page_icon="🎓", layout="wide") # Custom CSS style to make all pages red except for the text custom_css = """ -""" -st.markdown(custom_css, unsafe_allow_html=True) - # Function to load student data from Excel file def load_student_data(): try: From 3ef9be2fabd06365b7834571dbb7aeea39fab2a9 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:32:42 +0530 Subject: [PATCH 41/73] Rename streamlit_app.py to edu_app.py --- streamlit_app.py => edu_app.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename streamlit_app.py => edu_app.py (100%) diff --git a/streamlit_app.py b/edu_app.py similarity index 100% rename from streamlit_app.py rename to edu_app.py From 85f4e162700cb71f546923b6683fbe4f355271f2 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:43:37 +0530 Subject: [PATCH 42/73] Rename edu_app.py to streamlit_app.py --- edu_app.py => streamlit_app.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename edu_app.py => streamlit_app.py (100%) diff --git a/edu_app.py b/streamlit_app.py similarity index 100% rename from edu_app.py rename to streamlit_app.py From 270ce071fb8bf510e4d946b69b85272e92454aa5 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Sat, 27 Apr 2024 12:33:41 +0530 Subject: [PATCH 43/73] Update streamlit_app.py --- streamlit_app.py | 90 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 61 insertions(+), 29 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 8ac1e41616ff..b313b440803b 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,27 +1,52 @@ import streamlit as st import pandas as pd -# Function to load student data from Excel file +import mysql.connector + +# Function to connect to MySQL database +def connect_to_mysql(): + return mysql.connector.connect( + host="localhost", + user="root", + password="recovery", + database="test" + ) + +# Function to load student data from MySQL database def load_student_data(): - try: - return pd.read_excel("student_data.xlsx") - except FileNotFoundError: - return pd.DataFrame(columns=["Name", "Marks"]) - -# Function to add a new student to the DataFrame and Excel file -def add_student(student_df, name, marks): - if marks >= 75: # Check marks before adding - new_student = pd.DataFrame([[name, marks]], columns=["Name", "Marks"]) - student_df = pd.concat([student_df, new_student], ignore_index=True) - student_df.to_excel("student_data.xlsx", index=False) - return student_df + conn = connect_to_mysql() + cursor = conn.cursor() + cursor.execute("SELECT * FROM students") + columns = [desc[0] for desc in cursor.description] + student_data = cursor.fetchall() + cursor.close() + conn.close() + return pd.DataFrame(student_data, columns=columns) + +# Function to add a new student to the MySQL database +def add_student(name, marks): + conn = connect_to_mysql() + cursor = conn.cursor() + if marks >= 75: + cursor.execute("INSERT INTO students (Name, Marks) VALUES (%s, %s)", (name, marks)) + conn.commit() + cursor.close() + conn.close() + return True else: - return student_df # Don't add if marks < 75 + cursor.close() + conn.close() + return False # Function to check admission criteria -def check_admission(student_df, student_name): - student_row = student_df.loc[student_df["Name"] == student_name] - if not student_row.empty: - marks = student_row.iloc[0]["Marks"] +def check_admission(student_name): + conn = connect_to_mysql() + cursor = conn.cursor() + cursor.execute("SELECT Marks FROM students WHERE Name = %s", (student_name,)) + result = cursor.fetchone() + cursor.close() + conn.close() + if result: + marks = result[0] if marks >= 75: return f"{student_name} is admitted!" else: @@ -30,22 +55,29 @@ def check_admission(student_df, student_name): return f"{student_name} is not found in the database." # Function to filter students by course eligibility -def filter_students_by_course(student_df, course): +def filter_students_by_course(course): + conn = connect_to_mysql() + cursor = conn.cursor() if course == "Science": - return student_df[student_df["Marks"] >= 80] + cursor.execute("SELECT * FROM students WHERE Marks >= 80") elif course == "Economics": - return student_df[student_df["Marks"] >= 75] + cursor.execute("SELECT * FROM students WHERE Marks >= 75") elif course == "Humanities": - return student_df[student_df["Marks"] >= 70] + cursor.execute("SELECT * FROM students WHERE Marks >= 70") else: + cursor.close() + conn.close() return pd.DataFrame(columns=["Name", "Marks"]) # Return empty DataFrame if course is not recognized + columns = [desc[0] for desc in cursor.description] + eligible_students = cursor.fetchall() + cursor.close() + conn.close() + return pd.DataFrame(eligible_students, columns=columns) + # Streamlit UI st.title('Education System') -# Load student data (hidden) -student_df = load_student_data() - # Sidebar navigation page = st.sidebar.radio("Navigation", ('Home', 'Add Student', 'Admission Checker', 'Course Eligibility')) @@ -66,6 +98,7 @@ def filter_students_by_course(student_df, course): # Button to manage students if st.button("Manage Students"): + student_df = load_student_data() st.write(student_df) # Display student data elif page == 'Add Student': @@ -76,8 +109,7 @@ def filter_students_by_course(student_df, course): try: marks = int(marks_str) if st.button('Add Student'): # Button click to add student - student_df = add_student(student_df, name, marks) - if marks >= 75: + if add_student(name, marks): st.success(f"{name} added successfully!") else: st.warning(f"Student {name} not added. Marks should be 75 or greater for admission.") @@ -89,7 +121,7 @@ def filter_students_by_course(student_df, course): name = st.text_input("Enter student name to check admission:") if st.button('Check Admission'): # Button click to check admission - admission_status = check_admission(student_df, name) + admission_status = check_admission(name) st.write(admission_status) elif page == 'Course Eligibility': @@ -97,5 +129,5 @@ def filter_students_by_course(student_df, course): course = st.selectbox("Select a course:", ["Science", "Economics", "Humanities"]) st.write(f"Students eligible for {course} course:") - eligible_students = filter_students_by_course(student_df, course) + eligible_students = filter_students_by_course(course) st.write(eligible_students) From a187c576b585b1ea9ee389d165cb3023a3a46579 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Sat, 27 Apr 2024 12:34:52 +0530 Subject: [PATCH 44/73] Create azure-webapps-python.yml --- .github/workflows/azure-webapps-python.yml | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/azure-webapps-python.yml diff --git a/.github/workflows/azure-webapps-python.yml b/.github/workflows/azure-webapps-python.yml new file mode 100644 index 000000000000..51e6916a49f7 --- /dev/null +++ b/.github/workflows/azure-webapps-python.yml @@ -0,0 +1,86 @@ +# This workflow will build and push a Python application to an Azure Web App when a commit is pushed to your default branch. +# +# This workflow assumes you have already created the target Azure App Service web app. +# For instructions see https://docs.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=bash&pivots=python-framework-flask +# +# To configure this workflow: +# +# 1. Download the Publish Profile for your Azure Web App. You can download this file from the Overview page of your Web App in the Azure Portal. +# For more information: https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials +# +# 2. Create a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE, paste the publish profile contents as the value of the secret. +# For instructions on obtaining the publish profile see: https://docs.microsoft.com/azure/app-service/deploy-github-actions#configure-the-github-secret +# +# 3. Change the value for the AZURE_WEBAPP_NAME. Optionally, change the PYTHON_VERSION environment variables below. +# +# For more information on GitHub Actions for Azure: https://github.com/Azure/Actions +# For more information on the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples + +name: Build and deploy Python app to Azure Web App + +env: + AZURE_WEBAPP_NAME: your-app-name # set this to the name of your Azure Web App + PYTHON_VERSION: '3.8' # set this to the Python version to use + +on: + push: + branches: [ "master" ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python version + uses: actions/setup-python@v3.0.0 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: 'pip' + + - name: Create and start virtual environment + run: | + python -m venv venv + source venv/bin/activate + + - name: Install dependencies + run: pip install -r requirements.txt + + # Optional: Add step to run tests here (PyTest, Django test suites, etc.) + + - name: Upload artifact for deployment jobs + uses: actions/upload-artifact@v3 + with: + name: python-app + path: | + . + !venv/ + + deploy: + permissions: + contents: none + runs-on: ubuntu-latest + needs: build + environment: + name: 'Development' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v3 + with: + name: python-app + path: . + + - name: 'Deploy to Azure Web App' + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} From 68fdc21c5dc1e5a1430139e02aa90f2446130e9d Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Sat, 27 Apr 2024 12:55:48 +0530 Subject: [PATCH 45/73] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000000..6f401c61650f --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,36 @@ +# Python package +# Create and test a Python package on multiple Python versions. +# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/python + +trigger: +- master + +pool: + vmImage: ubuntu-latest +strategy: + matrix: + Python27: + python.version: '2.7' + Python35: + python.version: '3.5' + Python36: + python.version: '3.6' + Python37: + python.version: '3.7' + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + displayName: 'Use Python $(python.version)' + +- script: | + python -m pip install --upgrade pip + pip install -r requirements.txt + displayName: 'Install dependencies' + +- script: | + pip install pytest pytest-azurepipelines + pytest + displayName: 'pytest' From bdcc15ccbbd133b7d2d24e7dbc7c4292dd04088f Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Sat, 27 Apr 2024 13:09:52 +0530 Subject: [PATCH 46/73] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines-1.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 azure-pipelines-1.yml diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml new file mode 100644 index 000000000000..054d48cf0ca1 --- /dev/null +++ b/azure-pipelines-1.yml @@ -0,0 +1,26 @@ +trigger: +- master + +pool: + vmImage: 'ubuntu-latest' + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.x' # Use the latest Python 3 version + addToPath: true + +- script: | + python -m pip install --upgrade pip + pip install -r requirements.txt + displayName: 'Install dependencies' + +- script: | + pytest + displayName: 'Run tests' + +- script: | + streamlit_app.py # Replace app.py with the name of your Streamlit application file + displayName: 'Build Streamlit application' + +# Add deployment steps here to deploy your Streamlit application to your hosting platform From 12c199c290984942b0efbc3c3431bfe386ad284d Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:45:42 +0530 Subject: [PATCH 47/73] Update streamlit_app.py --- streamlit_app.py | 43 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index b313b440803b..bbf5ef9affe5 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -83,17 +83,13 @@ def filter_students_by_course(course): if page == 'Home': st.subheader('Welcome to the Education System!') - st.markdown(""" -

This platform allows you to manage student data and check admission eligibility.

-

To get started, you can:

-
    -
  • Click on Manage Students to view student data.
  • -
  • Click on Add Student to add new students.
  • -
  • Click on Admission Checker to check admission eligibility.
  • -
  • Click on Course Eligibility to see which students are eligible for specific courses.
  • -
- """, unsafe_allow_html=True) - + st.write("This platform allows you to manage student data and check admission eligibility.") + st.write("To get started, you can:") + st.write("- Click on 'Manage Students' to view student data.") + st.write("- Click on 'Add Student' to add new students.") + st.write("- Click on 'Admission Checker' to check admission eligibility.") + st.write("- Click on 'Course Eligibility' to see which students are eligible for specific courses.") + # Image or additional information can be added here for a more visually appealing layout # Button to manage students @@ -107,27 +103,4 @@ def filter_students_by_course(course): marks_str = st.text_input("Enter student marks:") try: - marks = int(marks_str) - if st.button('Add Student'): # Button click to add student - if add_student(name, marks): - st.success(f"{name} added successfully!") - else: - st.warning(f"Student {name} not added. Marks should be 75 or greater for admission.") - except ValueError: - st.error("Please enter a valid integer for marks.") - -elif page == 'Admission Checker': - st.subheader('Admission Checker') - name = st.text_input("Enter student name to check admission:") - - if st.button('Check Admission'): # Button click to check admission - admission_status = check_admission(name) - st.write(admission_status) - -elif page == 'Course Eligibility': - st.subheader('Course Eligibility') - course = st.selectbox("Select a course:", ["Science", "Economics", "Humanities"]) - - st.write(f"Students eligible for {course} course:") - eligible_students = filter_students_by_course(course) - st.write(eligible_students) + marks = int From ab3076dce272b1c8c75643b715336910931bb21b Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:51:26 +0530 Subject: [PATCH 48/73] Update streamlit_app.py --- streamlit_app.py | 105 +++++++++++------------------------------------ 1 file changed, 24 insertions(+), 81 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index bbf5ef9affe5..b1193d0d7be9 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,80 +1,3 @@ -import streamlit as st -import pandas as pd -import mysql.connector - -# Function to connect to MySQL database -def connect_to_mysql(): - return mysql.connector.connect( - host="localhost", - user="root", - password="recovery", - database="test" - ) - -# Function to load student data from MySQL database -def load_student_data(): - conn = connect_to_mysql() - cursor = conn.cursor() - cursor.execute("SELECT * FROM students") - columns = [desc[0] for desc in cursor.description] - student_data = cursor.fetchall() - cursor.close() - conn.close() - return pd.DataFrame(student_data, columns=columns) - -# Function to add a new student to the MySQL database -def add_student(name, marks): - conn = connect_to_mysql() - cursor = conn.cursor() - if marks >= 75: - cursor.execute("INSERT INTO students (Name, Marks) VALUES (%s, %s)", (name, marks)) - conn.commit() - cursor.close() - conn.close() - return True - else: - cursor.close() - conn.close() - return False - -# Function to check admission criteria -def check_admission(student_name): - conn = connect_to_mysql() - cursor = conn.cursor() - cursor.execute("SELECT Marks FROM students WHERE Name = %s", (student_name,)) - result = cursor.fetchone() - cursor.close() - conn.close() - if result: - marks = result[0] - if marks >= 75: - return f"{student_name} is admitted!" - else: - return f"{student_name} does not meet admission criteria (marks < 75)." - else: - return f"{student_name} is not found in the database." - -# Function to filter students by course eligibility -def filter_students_by_course(course): - conn = connect_to_mysql() - cursor = conn.cursor() - if course == "Science": - cursor.execute("SELECT * FROM students WHERE Marks >= 80") - elif course == "Economics": - cursor.execute("SELECT * FROM students WHERE Marks >= 75") - elif course == "Humanities": - cursor.execute("SELECT * FROM students WHERE Marks >= 70") - else: - cursor.close() - conn.close() - return pd.DataFrame(columns=["Name", "Marks"]) # Return empty DataFrame if course is not recognized - - columns = [desc[0] for desc in cursor.description] - eligible_students = cursor.fetchall() - cursor.close() - conn.close() - return pd.DataFrame(eligible_students, columns=columns) - # Streamlit UI st.title('Education System') @@ -90,9 +13,6 @@ def filter_students_by_course(course): st.write("- Click on 'Admission Checker' to check admission eligibility.") st.write("- Click on 'Course Eligibility' to see which students are eligible for specific courses.") - # Image or additional information can be added here for a more visually appealing layout - - # Button to manage students if st.button("Manage Students"): student_df = load_student_data() st.write(student_df) # Display student data @@ -103,4 +23,27 @@ def filter_students_by_course(course): marks_str = st.text_input("Enter student marks:") try: - marks = int + marks = int(marks_str) + if st.button('Add Student'): # Button click to add student + if add_student(name, marks): + st.success(f"{name} added successfully!") + else: + st.warning(f"Student {name} not added. Marks should be 75 or greater for admission.") + except ValueError: + st.error("Please enter a valid integer for marks.") + +elif page == 'Admission Checker': + st.subheader('Admission Checker') + name = st.text_input("Enter student name to check admission:") + + if st.button('Check Admission'): # Button click to check admission + admission_status = check_admission(name) + st.write(admission_status) + +elif page == 'Course Eligibility': + st.subheader('Course Eligibility') + course = st.selectbox("Select a course:", ["Science", "Economics", "Humanities"]) + + st.write(f"Students eligible for {course} course:") + eligible_students = filter_students_by_course(course) + st.write(eligible_students) From f4780dd70fa2569c2f90985f961526f7f203b449 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:52:06 +0530 Subject: [PATCH 49/73] Update streamlit_app.py --- streamlit_app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/streamlit_app.py b/streamlit_app.py index b1193d0d7be9..eb2a0def1027 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,3 +1,7 @@ +import streamlit as st +import pandas as pd +import mysql.connector + # Streamlit UI st.title('Education System') From ea2160d1f066af230bb261e172f824eb8ca99e05 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Tue, 30 Apr 2024 13:53:51 +0530 Subject: [PATCH 50/73] Update streamlit_app.py --- streamlit_app.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/streamlit_app.py b/streamlit_app.py index eb2a0def1027..e7dcf6ea7bf6 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -2,6 +2,79 @@ import pandas as pd import mysql.connector +# Function to connect to MySQL database +def connect_to_mysql(): + return mysql.connector.connect( + host="localhost", + user="root", + password="recovery", + database="test" + ) + +# Function to load student data from MySQL database +def load_student_data(): + conn = connect_to_mysql() + cursor = conn.cursor() + cursor.execute("SELECT * FROM students") + columns = [desc[0] for desc in cursor.description] + student_data = cursor.fetchall() + cursor.close() + conn.close() + return pd.DataFrame(student_data, columns=columns) + +# Function to add a new student to the MySQL database +def add_student(name, marks): + conn = connect_to_mysql() + cursor = conn.cursor() + if marks >= 75: + cursor.execute("INSERT INTO students (Name, Marks) VALUES (%s, %s)", (name, marks)) + conn.commit() + cursor.close() + conn.close() + return True + else: + cursor.close() + conn.close() + return False + +# Function to check admission criteria +def check_admission(student_name): + conn = connect_to_mysql() + cursor = conn.cursor() + cursor.execute("SELECT Marks FROM students WHERE Name = %s", (student_name,)) + result = cursor.fetchone() + cursor.close() + conn.close() + if result: + marks = result[0] + if marks >= 75: + return f"{student_name} is admitted!" + else: + return f"{student_name} does not meet admission criteria (marks < 75)." + else: + return f"{student_name} is not found in the database." + +# Function to filter students by course eligibility +def filter_students_by_course(course): + conn = connect_to_mysql() + cursor = conn.cursor() + if course == "Science": + cursor.execute("SELECT * FROM students WHERE Marks >= 80") + elif course == "Economics": + cursor.execute("SELECT * FROM students WHERE Marks >= 75") + elif course == "Humanities": + cursor.execute("SELECT * FROM students WHERE Marks >= 70") + else: + cursor.close() + conn.close() + return pd.DataFrame(columns=["Name", "Marks"]) # Return empty DataFrame if course is not recognized + + columns = [desc[0] for desc in cursor.description] + eligible_students = cursor.fetchall() + cursor.close() + conn.close() + return pd.DataFrame(eligible_students, columns=columns) + # Streamlit UI st.title('Education System') From c7dbf0c945965be38a614ab2df4651e563caf715 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 13:54:54 +0530 Subject: [PATCH 51/73] Update streamlit_app.py --- streamlit_app.py | 93 ++++++------------------------------------------ 1 file changed, 10 insertions(+), 83 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index e7dcf6ea7bf6..db155e2d38f4 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,79 +1,11 @@ import streamlit as st import pandas as pd -import mysql.connector -# Function to connect to MySQL database -def connect_to_mysql(): - return mysql.connector.connect( - host="localhost", - user="root", - password="recovery", - database="test" - ) - -# Function to load student data from MySQL database +# Function to load student data from Excel sheet def load_student_data(): - conn = connect_to_mysql() - cursor = conn.cursor() - cursor.execute("SELECT * FROM students") - columns = [desc[0] for desc in cursor.description] - student_data = cursor.fetchall() - cursor.close() - conn.close() - return pd.DataFrame(student_data, columns=columns) - -# Function to add a new student to the MySQL database -def add_student(name, marks): - conn = connect_to_mysql() - cursor = conn.cursor() - if marks >= 75: - cursor.execute("INSERT INTO students (Name, Marks) VALUES (%s, %s)", (name, marks)) - conn.commit() - cursor.close() - conn.close() - return True - else: - cursor.close() - conn.close() - return False - -# Function to check admission criteria -def check_admission(student_name): - conn = connect_to_mysql() - cursor = conn.cursor() - cursor.execute("SELECT Marks FROM students WHERE Name = %s", (student_name,)) - result = cursor.fetchone() - cursor.close() - conn.close() - if result: - marks = result[0] - if marks >= 75: - return f"{student_name} is admitted!" - else: - return f"{student_name} does not meet admission criteria (marks < 75)." - else: - return f"{student_name} is not found in the database." - -# Function to filter students by course eligibility -def filter_students_by_course(course): - conn = connect_to_mysql() - cursor = conn.cursor() - if course == "Science": - cursor.execute("SELECT * FROM students WHERE Marks >= 80") - elif course == "Economics": - cursor.execute("SELECT * FROM students WHERE Marks >= 75") - elif course == "Humanities": - cursor.execute("SELECT * FROM students WHERE Marks >= 70") - else: - cursor.close() - conn.close() - return pd.DataFrame(columns=["Name", "Marks"]) # Return empty DataFrame if course is not recognized - - columns = [desc[0] for desc in cursor.description] - eligible_students = cursor.fetchall() - cursor.close() - conn.close() - return pd.DataFrame(eligible_students, columns=columns) + # Read student data from Excel sheet + student_data = pd.read_excel("student_data.xlsx") + return student_data # Streamlit UI st.title('Education System') @@ -86,9 +18,6 @@ def filter_students_by_course(course): st.write("This platform allows you to manage student data and check admission eligibility.") st.write("To get started, you can:") st.write("- Click on 'Manage Students' to view student data.") - st.write("- Click on 'Add Student' to add new students.") - st.write("- Click on 'Admission Checker' to check admission eligibility.") - st.write("- Click on 'Course Eligibility' to see which students are eligible for specific courses.") if st.button("Manage Students"): student_df = load_student_data() @@ -102,10 +31,8 @@ def filter_students_by_course(course): try: marks = int(marks_str) if st.button('Add Student'): # Button click to add student - if add_student(name, marks): - st.success(f"{name} added successfully!") - else: - st.warning(f"Student {name} not added. Marks should be 75 or greater for admission.") + # Add student functionality can be added here + st.success(f"{name} added successfully!") except ValueError: st.error("Please enter a valid integer for marks.") @@ -114,13 +41,13 @@ def filter_students_by_course(course): name = st.text_input("Enter student name to check admission:") if st.button('Check Admission'): # Button click to check admission - admission_status = check_admission(name) - st.write(admission_status) + # Admission checker functionality can be added here + st.write("Admission status functionality can be implemented here.") elif page == 'Course Eligibility': st.subheader('Course Eligibility') course = st.selectbox("Select a course:", ["Science", "Economics", "Humanities"]) st.write(f"Students eligible for {course} course:") - eligible_students = filter_students_by_course(course) - st.write(eligible_students) + # Course eligibility functionality can be added here + st.write("Course eligibility functionality can be implemented here.") From d1d8eb3e1a1029bfc6e41aca184a4a492ea107b8 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:01:06 +0530 Subject: [PATCH 52/73] Update requirements.txt --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 36ef878899d6..fb8ca44de5ba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ altair pandas streamlit -mysql-connector-python openpyxl From 03cf743e2ca069c34832d40f5cc145d4cf27c9c7 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:06:47 +0530 Subject: [PATCH 53/73] Update streamlit_app.py --- streamlit_app.py | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index db155e2d38f4..aee00e58dc7a 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -4,9 +4,33 @@ # Function to load student data from Excel sheet def load_student_data(): # Read student data from Excel sheet - student_data = pd.read_excel("student_data.xlsx") + student_data = pd.read_excel("students.xlsx") return student_data +# Function to add a new student to the Excel sheet +def add_student(name, marks): + student_df = load_student_data() + if name in student_df["Name"].values: + st.warning("Student already exists in the database.") + elif marks >= 75: + # Add student functionality here (e.g., append to Excel sheet) + st.success(f"{name} added successfully!") + else: + st.warning("Student not added. Marks should be 75 or greater for admission.") + +# Function to filter students by course eligibility +def filter_students_by_course(course): + student_df = load_student_data() + if course == "Science": + eligible_students = student_df[student_df["Marks"] >= 80] + elif course == "Economics": + eligible_students = student_df[student_df["Marks"] >= 75] + elif course == "Humanities": + eligible_students = student_df[student_df["Marks"] >= 70] + else: + eligible_students = pd.DataFrame(columns=["Name", "Marks"]) # Return empty DataFrame if course is not recognized + return eligible_students + # Streamlit UI st.title('Education System') @@ -31,8 +55,7 @@ def load_student_data(): try: marks = int(marks_str) if st.button('Add Student'): # Button click to add student - # Add student functionality can be added here - st.success(f"{name} added successfully!") + add_student(name, marks) except ValueError: st.error("Please enter a valid integer for marks.") @@ -49,5 +72,5 @@ def load_student_data(): course = st.selectbox("Select a course:", ["Science", "Economics", "Humanities"]) st.write(f"Students eligible for {course} course:") - # Course eligibility functionality can be added here - st.write("Course eligibility functionality can be implemented here.") + eligible_students = filter_students_by_course(course) + st.write(eligible_students) From 10cf1af573dd5f8fd04a3e1fb8c42ace60a6c0e0 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:08:39 +0530 Subject: [PATCH 54/73] Update streamlit_app.py --- streamlit_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index aee00e58dc7a..46a2334b157d 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -4,7 +4,7 @@ # Function to load student data from Excel sheet def load_student_data(): # Read student data from Excel sheet - student_data = pd.read_excel("students.xlsx") + student_data = pd.read_excel("student_data.xlsx") return student_data # Function to add a new student to the Excel sheet From ae80ba2255df6b870471a422d72aabb8e649b0a9 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:10:40 +0530 Subject: [PATCH 55/73] Update streamlit_app.py --- streamlit_app.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index 46a2334b157d..23339be90cc5 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -13,7 +13,13 @@ def add_student(name, marks): if name in student_df["Name"].values: st.warning("Student already exists in the database.") elif marks >= 75: - # Add student functionality here (e.g., append to Excel sheet) + # Add student to DataFrame + new_student = pd.DataFrame({"Name": [name], "Marks": [marks]}) + student_df = student_df.append(new_student, ignore_index=True) + + # Write updated DataFrame to Excel sheet + student_df.to_excel("students.xlsx", index=False) + st.success(f"{name} added successfully!") else: st.warning("Student not added. Marks should be 75 or greater for admission.") From 5317d529c31b537628781d62b905c081991a5a3d Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:12:34 +0530 Subject: [PATCH 56/73] Update streamlit_app.py --- streamlit_app.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 23339be90cc5..8fe8d3e639f8 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -7,23 +7,22 @@ def load_student_data(): student_data = pd.read_excel("student_data.xlsx") return student_data -# Function to add a new student to the Excel sheet def add_student(name, marks): student_df = load_student_data() if name in student_df["Name"].values: st.warning("Student already exists in the database.") elif marks >= 75: - # Add student to DataFrame + # Create a new DataFrame with the new student data new_student = pd.DataFrame({"Name": [name], "Marks": [marks]}) - student_df = student_df.append(new_student, ignore_index=True) - - # Write updated DataFrame to Excel sheet + # Append the new student DataFrame to the existing student DataFrame + student_df = pd.concat([student_df, new_student], ignore_index=True) + # Write the updated DataFrame to the Excel sheet student_df.to_excel("students.xlsx", index=False) - st.success(f"{name} added successfully!") else: st.warning("Student not added. Marks should be 75 or greater for admission.") + # Function to filter students by course eligibility def filter_students_by_course(course): student_df = load_student_data() From b5a524cacc866c8ca9f9ac8782e4dc07bd6baa6f Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:15:46 +0530 Subject: [PATCH 57/73] Update streamlit_app.py --- streamlit_app.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 8fe8d3e639f8..8ba1d5e56741 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -23,6 +23,7 @@ def add_student(name, marks): st.warning("Student not added. Marks should be 75 or greater for admission.") + # Function to filter students by course eligibility def filter_students_by_course(course): student_df = load_student_data() @@ -69,8 +70,9 @@ def filter_students_by_course(course): name = st.text_input("Enter student name to check admission:") if st.button('Check Admission'): # Button click to check admission - # Admission checker functionality can be added here - st.write("Admission status functionality can be implemented here.") + admission_status = check_admission(name) + st.write(admission_status) + elif page == 'Course Eligibility': st.subheader('Course Eligibility') From a700e186970c5338f510dbd28a07639dd5bc110e Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:18:51 +0530 Subject: [PATCH 58/73] Update streamlit_app.py --- streamlit_app.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 8ba1d5e56741..5c57c8f35197 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -70,8 +70,13 @@ def filter_students_by_course(course): name = st.text_input("Enter student name to check admission:") if st.button('Check Admission'): # Button click to check admission - admission_status = check_admission(name) - st.write(admission_status) + student_found = name in load_student_data()["Name"].values + if student_found: + admission_status = check_admission(name) + st.write(admission_status) + else: + st.write("Student not found in the database.") + elif page == 'Course Eligibility': From b185f2f3d4a4854350bfd78bd832373f34e3f58d Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:20:36 +0530 Subject: [PATCH 59/73] Update streamlit_app.py --- streamlit_app.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 5c57c8f35197..253c7f499f90 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -69,14 +69,16 @@ def filter_students_by_course(course): st.subheader('Admission Checker') name = st.text_input("Enter student name to check admission:") + elif page == 'Admission Checker': + st.subheader('Admission Checker') + name = st.text_input("Enter student name to check admission:") + if st.button('Check Admission'): # Button click to check admission - student_found = name in load_student_data()["Name"].values - if student_found: - admission_status = check_admission(name) - st.write(admission_status) + student_df = load_student_data() + if name in student_df["Name"].values: + st.write("Student found.") else: - st.write("Student not found in the database.") - + st.write("Student not found.") elif page == 'Course Eligibility': From 074697584992bfb1f4eb5c71210180488dad140c Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:21:45 +0530 Subject: [PATCH 60/73] Update streamlit_app.py --- streamlit_app.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 253c7f499f90..822c0bd9c485 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -70,15 +70,15 @@ def filter_students_by_course(course): name = st.text_input("Enter student name to check admission:") elif page == 'Admission Checker': - st.subheader('Admission Checker') - name = st.text_input("Enter student name to check admission:") - - if st.button('Check Admission'): # Button click to check admission - student_df = load_student_data() - if name in student_df["Name"].values: - st.write("Student found.") - else: - st.write("Student not found.") + st.subheader('Admission Checker') + name = st.text_input("Enter student name to check admission:") + + if st.button('Check Admission'): # Button click to check admission + student_df = load_student_data() + if name in student_df["Name"].values: + st.write("Student found.") + else: + st.write("Student not found.") elif page == 'Course Eligibility': From 8d0951bd4497a23b74784feccbccead952f8e9a9 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:26:53 +0530 Subject: [PATCH 61/73] Update streamlit_app.py --- streamlit_app.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 822c0bd9c485..cee5eff6cdd3 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -69,17 +69,12 @@ def filter_students_by_course(course): st.subheader('Admission Checker') name = st.text_input("Enter student name to check admission:") - elif page == 'Admission Checker': - st.subheader('Admission Checker') - name = st.text_input("Enter student name to check admission:") - - if st.button('Check Admission'): # Button click to check admission - student_df = load_student_data() - if name in student_df["Name"].values: - st.write("Student found.") - else: - st.write("Student not found.") - + if st.button('Check Admission'): # Button click to check admission + student_df = load_student_data() + if name in student_df["Name"].values: + st.write("Student found.") + else: + st.write("Student not found.") elif page == 'Course Eligibility': st.subheader('Course Eligibility') From e8c70ff15523a48ef2e44bcf83b5af4fa02f1656 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:28:14 +0530 Subject: [PATCH 62/73] Update streamlit_app.py --- streamlit_app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index cee5eff6cdd3..16f5c2c871dd 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -17,10 +17,13 @@ def add_student(name, marks): # Append the new student DataFrame to the existing student DataFrame student_df = pd.concat([student_df, new_student], ignore_index=True) # Write the updated DataFrame to the Excel sheet - student_df.to_excel("students.xlsx", index=False) + student_df.to_excel("student_data.xlsx", index=False) # Updated file name st.success(f"{name} added successfully!") + return student_df # Return the updated DataFrame else: st.warning("Student not added. Marks should be 75 or greater for admission.") + return student_df # Return the original DataFrame if student not added + From c40cee577689c85f56bb4323ab990733f6f19895 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:29:36 +0530 Subject: [PATCH 63/73] Update streamlit_app.py --- streamlit_app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index 16f5c2c871dd..9a5eb3eb963b 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -64,10 +64,12 @@ def filter_students_by_course(course): try: marks = int(marks_str) if st.button('Add Student'): # Button click to add student - add_student(name, marks) + student_df = add_student(name, marks) # Update the DataFrame after adding student + st.write(student_df) # Display updated student data except ValueError: st.error("Please enter a valid integer for marks.") + elif page == 'Admission Checker': st.subheader('Admission Checker') name = st.text_input("Enter student name to check admission:") From 164dd678c6fe6bfa2bd3c63284e096a1acebfce0 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:32:14 +0530 Subject: [PATCH 64/73] Update streamlit_app.py --- streamlit_app.py | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 9a5eb3eb963b..f8f82bbb3222 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -1,5 +1,6 @@ import streamlit as st import pandas as pd +import matplotlib.pyplot as plt # Function to load student data from Excel sheet def load_student_data(): @@ -7,26 +8,6 @@ def load_student_data(): student_data = pd.read_excel("student_data.xlsx") return student_data -def add_student(name, marks): - student_df = load_student_data() - if name in student_df["Name"].values: - st.warning("Student already exists in the database.") - elif marks >= 75: - # Create a new DataFrame with the new student data - new_student = pd.DataFrame({"Name": [name], "Marks": [marks]}) - # Append the new student DataFrame to the existing student DataFrame - student_df = pd.concat([student_df, new_student], ignore_index=True) - # Write the updated DataFrame to the Excel sheet - student_df.to_excel("student_data.xlsx", index=False) # Updated file name - st.success(f"{name} added successfully!") - return student_df # Return the updated DataFrame - else: - st.warning("Student not added. Marks should be 75 or greater for admission.") - return student_df # Return the original DataFrame if student not added - - - - # Function to filter students by course eligibility def filter_students_by_course(course): student_df = load_student_data() @@ -44,7 +25,7 @@ def filter_students_by_course(course): st.title('Education System') # Sidebar navigation -page = st.sidebar.radio("Navigation", ('Home', 'Add Student', 'Admission Checker', 'Course Eligibility')) +page = st.sidebar.radio("Navigation", ('Home', 'Add Student', 'Admission Checker', 'Course Eligibility', 'Data Visualization')) if page == 'Home': st.subheader('Welcome to the Education System!') @@ -69,7 +50,6 @@ def filter_students_by_course(course): except ValueError: st.error("Please enter a valid integer for marks.") - elif page == 'Admission Checker': st.subheader('Admission Checker') name = st.text_input("Enter student name to check admission:") @@ -88,3 +68,27 @@ def filter_students_by_course(course): st.write(f"Students eligible for {course} course:") eligible_students = filter_students_by_course(course) st.write(eligible_students) + +elif page == 'Data Visualization': + st.subheader('Data Visualization') + + # Load student data + student_df = load_student_data() + + # Histogram of student marks distribution + st.write("Histogram of Student Marks Distribution") + plt.hist(student_df["Marks"], bins=10, color='skyblue', edgecolor='black') + plt.xlabel('Marks') + plt.ylabel('Frequency') + plt.title('Distribution of Student Marks') + st.pyplot() + + # Pie chart showing percentage of students eligible for each course + st.write("Pie Chart: Percentage of Students Eligible for Each Course") + course_counts = student_df.groupby("Course").size() + st.write(course_counts) + plt.figure(figsize=(8, 6)) + plt.pie(course_counts, labels=course_counts.index, autopct='%1.1f%%', startangle=140) + plt.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. + plt.title('Percentage of Students Eligible for Each Course') + st.pyplot() From 18635ff1c2881cc16354dee0419e6e206aae6c28 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:33:44 +0530 Subject: [PATCH 65/73] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index fb8ca44de5ba..df7a9901b268 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ altair pandas streamlit openpyxl +matplotlib From 7e67ef874bc990d3c031311d391b33b587ddd3e6 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 14:35:08 +0530 Subject: [PATCH 66/73] Update streamlit_app.py --- streamlit_app.py | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index f8f82bbb3222..c2552b9520fa 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -75,20 +75,25 @@ def filter_students_by_course(course): # Load student data student_df = load_student_data() - # Histogram of student marks distribution - st.write("Histogram of Student Marks Distribution") - plt.hist(student_df["Marks"], bins=10, color='skyblue', edgecolor='black') - plt.xlabel('Marks') - plt.ylabel('Frequency') - plt.title('Distribution of Student Marks') - st.pyplot() - - # Pie chart showing percentage of students eligible for each course - st.write("Pie Chart: Percentage of Students Eligible for Each Course") - course_counts = student_df.groupby("Course").size() - st.write(course_counts) - plt.figure(figsize=(8, 6)) - plt.pie(course_counts, labels=course_counts.index, autopct='%1.1f%%', startangle=140) - plt.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. - plt.title('Percentage of Students Eligible for Each Course') - st.pyplot() + # Check if the "Course" column exists + if "Course" not in student_df.columns: + st.error("The 'Course' column is missing in the student data.") + else: + # Histogram of student marks distribution + st.write("Histogram of Student Marks Distribution") + plt.hist(student_df["Marks"], bins=10, color='skyblue', edgecolor='black') + plt.xlabel('Marks') + plt.ylabel('Frequency') + plt.title('Distribution of Student Marks') + st.pyplot() + + # Pie chart showing percentage of students eligible for each course + st.write("Pie Chart: Percentage of Students Eligible for Each Course") + course_counts = student_df.groupby("Course").size() + st.write(course_counts) + plt.figure(figsize=(8, 6)) + plt.pie(course_counts, labels=course_counts.index, autopct='%1.1f%%', startangle=140) + plt.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. + plt.title('Percentage of Students Eligible for Each Course') + st.pyplot() + From b39dd6ec2530dbe8483016b18469dd5dff3cf747 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 15:06:56 +0530 Subject: [PATCH 67/73] Update streamlit_app.py --- streamlit_app.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/streamlit_app.py b/streamlit_app.py index c2552b9520fa..76fe2ff8e7f0 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -75,6 +75,12 @@ def filter_students_by_course(course): # Load student data student_df = load_student_data() + # Print column names for debugging + st.write("Column Names:", student_df.columns) + + # Display DataFrame for debugging + st.write("DataFrame:", student_df) + # Check if the "Course" column exists if "Course" not in student_df.columns: st.error("The 'Course' column is missing in the student data.") @@ -96,4 +102,3 @@ def filter_students_by_course(course): plt.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. plt.title('Percentage of Students Eligible for Each Course') st.pyplot() - From 34286571bb7f1d434052c301d801dd9512cab0de Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 15:08:39 +0530 Subject: [PATCH 68/73] Update streamlit_app.py --- streamlit_app.py | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index 76fe2ff8e7f0..fd743b4275e6 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -75,15 +75,9 @@ def filter_students_by_course(course): # Load student data student_df = load_student_data() - # Print column names for debugging - st.write("Column Names:", student_df.columns) - - # Display DataFrame for debugging - st.write("DataFrame:", student_df) - - # Check if the "Course" column exists - if "Course" not in student_df.columns: - st.error("The 'Course' column is missing in the student data.") + # Check if the "Marks" column exists + if "Marks" not in student_df.columns: + st.error("The 'Marks' column is missing in the student data.") else: # Histogram of student marks distribution st.write("Histogram of Student Marks Distribution") @@ -92,13 +86,3 @@ def filter_students_by_course(course): plt.ylabel('Frequency') plt.title('Distribution of Student Marks') st.pyplot() - - # Pie chart showing percentage of students eligible for each course - st.write("Pie Chart: Percentage of Students Eligible for Each Course") - course_counts = student_df.groupby("Course").size() - st.write(course_counts) - plt.figure(figsize=(8, 6)) - plt.pie(course_counts, labels=course_counts.index, autopct='%1.1f%%', startangle=140) - plt.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. - plt.title('Percentage of Students Eligible for Each Course') - st.pyplot() From d5748fcc199ca7ee0108df821aa38ee3d92f2030 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 15:09:47 +0530 Subject: [PATCH 69/73] Update streamlit_app.py --- streamlit_app.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index fd743b4275e6..d37620fa51f9 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -81,8 +81,9 @@ def filter_students_by_course(course): else: # Histogram of student marks distribution st.write("Histogram of Student Marks Distribution") - plt.hist(student_df["Marks"], bins=10, color='skyblue', edgecolor='black') - plt.xlabel('Marks') - plt.ylabel('Frequency') - plt.title('Distribution of Student Marks') - st.pyplot() + fig, ax = plt.subplots() + ax.hist(student_df["Marks"], bins=10, color='skyblue', edgecolor='black') + ax.set_xlabel('Marks') + ax.set_ylabel('Frequency') + ax.set_title('Distribution of Student Marks') + st.pyplot(fig) From 29032f803fde66a5675464f4205849a221f7e837 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 15:11:25 +0530 Subject: [PATCH 70/73] Update streamlit_app.py --- streamlit_app.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index d37620fa51f9..e70e23953839 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -37,18 +37,21 @@ def filter_students_by_course(course): student_df = load_student_data() st.write(student_df) # Display student data -elif page == 'Add Student': - st.subheader('Add New Student') - name = st.text_input("Enter student name:") - marks_str = st.text_input("Enter student marks:") - - try: - marks = int(marks_str) - if st.button('Add Student'): # Button click to add student - student_df = add_student(name, marks) # Update the DataFrame after adding student - st.write(student_df) # Display updated student data - except ValueError: - st.error("Please enter a valid integer for marks.") +def add_student(name, marks): + student_df = load_student_data() + if name in student_df["Name"].values: + st.warning("Student already exists in the database.") + elif marks >= 75: + # Create a new DataFrame with the new student data + new_student = pd.DataFrame({"Name": [name], "Marks": [marks]}) + # Append the new student DataFrame to the existing student DataFrame + student_df = pd.concat([student_df, new_student], ignore_index=True) + # Write the updated DataFrame to the Excel sheet (if needed) + # student_df.to_excel("students.xlsx", index=False) + st.success(f"{name} added successfully!") + else: + st.warning("Student not added. Marks should be 75 or greater for admission.") + return student_df # Return the updated DataFrame elif page == 'Admission Checker': st.subheader('Admission Checker') From daa10c63783d946b31588da74e7bc8a5fa1aae54 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 15:12:16 +0530 Subject: [PATCH 71/73] Update streamlit_app.py From d432f62308a9c7d707217ac9828142a2008d2cc5 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 15:13:50 +0530 Subject: [PATCH 72/73] Update streamlit_app.py --- streamlit_app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/streamlit_app.py b/streamlit_app.py index e70e23953839..dd6397a11774 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -53,6 +53,8 @@ def add_student(name, marks): st.warning("Student not added. Marks should be 75 or greater for admission.") return student_df # Return the updated DataFrame +# Other pages (Admission Checker, Course Eligibility, Data Visualization) follow + elif page == 'Admission Checker': st.subheader('Admission Checker') name = st.text_input("Enter student name to check admission:") From b9ddfd7aaaf27fc1d910e993bcca0b69217ac8d7 Mon Sep 17 00:00:00 2001 From: Yuven23 <166003361+Yuven23@users.noreply.github.com> Date: Wed, 1 May 2024 15:15:49 +0530 Subject: [PATCH 73/73] Update streamlit_app.py --- streamlit_app.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/streamlit_app.py b/streamlit_app.py index dd6397a11774..fc5112932b45 100644 --- a/streamlit_app.py +++ b/streamlit_app.py @@ -53,9 +53,7 @@ def add_student(name, marks): st.warning("Student not added. Marks should be 75 or greater for admission.") return student_df # Return the updated DataFrame -# Other pages (Admission Checker, Course Eligibility, Data Visualization) follow - -elif page == 'Admission Checker': +if page == 'Admission Checker': st.subheader('Admission Checker') name = st.text_input("Enter student name to check admission:")