File size: 4,378 Bytes
a42bad0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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()