Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
# Load the Excel sheet
|
| 5 |
+
@st.cache
|
| 6 |
+
def load_data(file_path):
|
| 7 |
+
return pd.read_excel(file_path)
|
| 8 |
+
|
| 9 |
+
# Load data
|
| 10 |
+
data = load_data('students_data.xlsx') # Replace with your file path
|
| 11 |
+
|
| 12 |
+
# Streamlit UI
|
| 13 |
+
st.title('Student Information System')
|
| 14 |
+
|
| 15 |
+
# Input fields
|
| 16 |
+
search_by = st.selectbox('Search By', ['Registration Number', 'Name & Father Name'])
|
| 17 |
+
|
| 18 |
+
if search_by == 'Registration Number':
|
| 19 |
+
registration_number = st.text_input('Enter Registration Number')
|
| 20 |
+
if st.button('Search'):
|
| 21 |
+
result = data[data['Registration Number'] == registration_number]
|
| 22 |
+
if not result.empty:
|
| 23 |
+
st.write(result)
|
| 24 |
+
else:
|
| 25 |
+
st.error('No records found')
|
| 26 |
+
else:
|
| 27 |
+
student_name = st.text_input('Enter Student Name')
|
| 28 |
+
father_name = st.text_input('Enter Father Name')
|
| 29 |
+
if st.button('Search'):
|
| 30 |
+
result = data[(data['Student Name'] == student_name) & (data['Father Name'] == father_name)]
|
| 31 |
+
if not result.empty:
|
| 32 |
+
st.write(result)
|
| 33 |
+
else:
|
| 34 |
+
st.error('No records found')
|