NithyasriVllB commited on
Commit
597120e
·
verified ·
1 Parent(s): 7416034

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import matplotlib.pyplot as plt
4
+
5
+ # Function to visualize student progress
6
+ def visualize_progress(file):
7
+ df = pd.read_csv(file.name) # Reading the uploaded CSV file
8
+
9
+ plt.figure(figsize=(10,6))
10
+ for student in df['student_name'].unique():
11
+ student_data = df[df['student_name'] == student]
12
+ plt.plot(student_data['date'], student_data['score'], label=student)
13
+
14
+ plt.xlabel('Date')
15
+ plt.ylabel('Score')
16
+ plt.title('Student Progress Over Time')
17
+ plt.legend()
18
+ plt.grid(True)
19
+
20
+ plt.savefig('progress.png') # Save the plot to display it later
21
+ return 'progress.png'
22
+
23
+ # Gradio UI
24
+ with gr.Blocks() as demo:
25
+ gr.Markdown("# Student Progress Analysis Tool")
26
+
27
+ # File input and display output
28
+ file_input = gr.File(label="Upload Student Data (CSV)")
29
+ output_image = gr.Image(label="Progress Chart")
30
+
31
+ # Call the visualize_progress function
32
+ file_input.change(visualize_progress, inputs=file_input, outputs=output_image)
33
+
34
+ demo.launch()