dramit80's picture
Upload app.py
a42bad0 verified
import gradio as gr
import pandas as pd
from datetime import datetime
# Student Data Management
def add_student(name, grade, roll_no, parent_phone):
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
new_student = {
"Name": name,
"Grade": grade,
"Roll_No": roll_no,
"Parent_Phone": parent_phone,
"Added_On": timestamp
}
return f"✅ विद्यार्थी नोंदणी झाली: {name}"
def add_teacher(name, subject, phone, qualifications):
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
new_teacher = {
"Name": name,
"Subject": subject,
"Phone": phone,
"Qualifications": qualifications,
"Joined_On": timestamp
}
return f"✅ शिक्षक नोंदणी झाली: {name}"
# Search Functions
def search_student(name):
# यात तुमचा data शोधण्याचा code येईल
return f"🔍 {name} ची माहिती सापडली"
def search_teacher(name):
# यात तुमचा data शोधण्याचा code येईल
return f"🔍 {name} शिक्षकाची माहिती सापडली"
# Gradio Interface
with gr.Blocks(theme=gr.themes.Soft(), title="शाळा डेटा व्यवस्थापन") as app:
gr.Markdown("# 🏫 माझी शाळा - डेटा व्यवस्थापन")
with gr.Tab("📚 विद्यार्थी नोंदणी"):
with gr.Row():
with gr.Column():
student_name = gr.Textbox(label="विद्यार्थ्याचे नाव")
student_grade = gr.Dropdown(["1ली", "2री", "3री", "4थी", "5वी", "6वी", "7वी", "8वी", "9वी", "10वी"], label="इयत्ता")
roll_no = gr.Number(label="रोल नंबर")
parent_phone = gr.Textbox(label="पालकांचा मोबाइल नंबर")
add_student_btn = gr.Button("विद्यार्थी नोंदवा")
with gr.Column():
student_output = gr.Textbox(label="निकाल")
with gr.Tab("👨‍🏫 शिक्षक नोंदणी"):
with gr.Row():
with gr.Column():
teacher_name = gr.Textbox(label="शिक्षकाचे नाव")
teacher_subject = gr.Dropdown(["मराठी", "हिंदी", "इंग्रजी", "गणित", "विज्ञान", "सामाजिक शास्त्र", "इतिहास", "भूगोल"], label="विषय")
teacher_phone = gr.Textbox(label="मोबाइल नंबर")
teacher_qualifications = gr.Textbox(label="पात्रता")
add_teacher_btn = gr.Button("शिक्षक नोंदवा")
with gr.Column():
teacher_output = gr.Textbox(label="निकाल")
with gr.Tab("🔍 माहिती शोधा"):
with gr.Row():
with gr.Column():
search_student_name = gr.Textbox(label="विद्यार्थ्याचे नाव शोधा")
search_student_btn = gr.Button("विद्यार्थी शोधा")
with gr.Column():
search_teacher_name = gr.Textbox(label="शिक्षकाचे नाव शोधा")
search_teacher_btn = gr.Button("शिक्षक शोधा")
search_output = gr.Textbox(label="शोध निकाल")
# Button Clicks
add_student_btn.click(
add_student,
inputs=[student_name, student_grade, roll_no, parent_phone],
outputs=student_output
)
add_teacher_btn.click(
add_teacher,
inputs=[teacher_name, teacher_subject, teacher_phone, teacher_qualifications],
outputs=teacher_output
)
search_student_btn.click(
search_student,
inputs=[search_student_name],
outputs=search_output
)
search_teacher_btn.click(
search_teacher,
inputs=[search_teacher_name],
outputs=search_output
)
if __name__ == "__main__":
app.launch()