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()