File size: 1,163 Bytes
f8b5ae3
 
 
 
 
 
 
 
 
8b67c4c
f8b5ae3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a26505a
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
import gradio as gr
import pandas as pd
from processAttendance import *
import os



def findMismatchedStudents(file):
    # Use the corrected path
    base_dir = os.getcwd()+"/processAttendance"
    
    # Construct file paths
    csvFileName = os.path.join(base_dir, "attendance.csv")
    busAssignedListFile = os.path.join(base_dir, "busAssignedList.csv")
    mismatchedStudentsFile = os.path.join(base_dir, "mismatchedStudents.csv")
    
    # Process the files
    extract_route_emails_and_timestamps(file.name, csvFileName)
    find_mismatched_students(busAssignedListFile, csvFileName, mismatchedStudentsFile)
    
    # Return the mismatched students data
    return pd.read_csv(mismatchedStudentsFile)




# Define the Gradio interface
interface = gr.Interface(
    fn=findMismatchedStudents,  # Function to call
    inputs=gr.File(type='filepath', label="Upload Excel File"),  # File input
    outputs=gr.Dataframe(),  # DataFrame output
    title="Bus Boarding",  # Title of the app
    description="Upload Attendance file to find the students who boarded the wrong bus",  # Description
    allow_flagging="never"
)

# Launch the app
interface.launch()