Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,38 +1,38 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import pandas as pd
|
3 |
-
from processAttendance import *
|
4 |
-
import os
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
def findMismatchedStudents(file):
|
9 |
-
# Use the corrected path
|
10 |
-
base_dir =
|
11 |
-
|
12 |
-
# Construct file paths
|
13 |
-
csvFileName = os.path.join(base_dir, "attendance.csv")
|
14 |
-
busAssignedListFile = os.path.join(base_dir, "busAssignedList.csv")
|
15 |
-
mismatchedStudentsFile = os.path.join(base_dir, "mismatchedStudents.csv")
|
16 |
-
|
17 |
-
# Process the files
|
18 |
-
extract_route_emails_and_timestamps(file.name, csvFileName)
|
19 |
-
find_mismatched_students(busAssignedListFile, csvFileName, mismatchedStudentsFile)
|
20 |
-
|
21 |
-
# Return the mismatched students data
|
22 |
-
return pd.read_csv(mismatchedStudentsFile)
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
# Define the Gradio interface
|
28 |
-
interface = gr.Interface(
|
29 |
-
fn=findMismatchedStudents, # Function to call
|
30 |
-
inputs=gr.File(type='filepath', label="Upload Excel File"), # File input
|
31 |
-
outputs=gr.Dataframe(), # DataFrame output
|
32 |
-
title="Bus Boarding", # Title of the app
|
33 |
-
description="Upload Attendance file to find the students who boarded the wrong bus", # Description
|
34 |
-
allow_flagging="never"
|
35 |
-
)
|
36 |
-
|
37 |
-
# Launch the app
|
38 |
interface.launch()
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
from processAttendance import *
|
4 |
+
import os
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
def findMismatchedStudents(file):
|
9 |
+
# Use the corrected path
|
10 |
+
base_dir = os.cwd()+"/processAttendance"
|
11 |
+
|
12 |
+
# Construct file paths
|
13 |
+
csvFileName = os.path.join(base_dir, "attendance.csv")
|
14 |
+
busAssignedListFile = os.path.join(base_dir, "busAssignedList.csv")
|
15 |
+
mismatchedStudentsFile = os.path.join(base_dir, "mismatchedStudents.csv")
|
16 |
+
|
17 |
+
# Process the files
|
18 |
+
extract_route_emails_and_timestamps(file.name, csvFileName)
|
19 |
+
find_mismatched_students(busAssignedListFile, csvFileName, mismatchedStudentsFile)
|
20 |
+
|
21 |
+
# Return the mismatched students data
|
22 |
+
return pd.read_csv(mismatchedStudentsFile)
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
# Define the Gradio interface
|
28 |
+
interface = gr.Interface(
|
29 |
+
fn=findMismatchedStudents, # Function to call
|
30 |
+
inputs=gr.File(type='filepath', label="Upload Excel File"), # File input
|
31 |
+
outputs=gr.Dataframe(), # DataFrame output
|
32 |
+
title="Bus Boarding", # Title of the app
|
33 |
+
description="Upload Attendance file to find the students who boarded the wrong bus", # Description
|
34 |
+
allow_flagging="never"
|
35 |
+
)
|
36 |
+
|
37 |
+
# Launch the app
|
38 |
interface.launch()
|