Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
df = pd.read_csv("
|
| 6 |
|
| 7 |
def get_feedback(student_id):
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
student_data = df[df['Student ID'] == student_id]
|
| 10 |
|
| 11 |
if not student_data.empty:
|
|
@@ -14,14 +18,12 @@ def get_feedback(student_id):
|
|
| 14 |
else:
|
| 15 |
return "Student ID not found."
|
| 16 |
|
| 17 |
-
# Create the Gradio interface
|
| 18 |
iface = gr.Interface(
|
| 19 |
fn=get_feedback,
|
| 20 |
-
inputs="
|
| 21 |
-
outputs="
|
| 22 |
title="Student Feedback System",
|
| 23 |
-
description="Enter a Student ID to get
|
| 24 |
)
|
| 25 |
|
| 26 |
-
# Launch the app
|
| 27 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
+
# Corrected file name
|
| 5 |
+
df = pd.read_csv("student_marks_feedback.csv")
|
| 6 |
|
| 7 |
def get_feedback(student_id):
|
| 8 |
+
try:
|
| 9 |
+
student_id = int(student_id)
|
| 10 |
+
except ValueError:
|
| 11 |
+
return "Please enter a valid numeric Student ID."
|
| 12 |
+
|
| 13 |
student_data = df[df['Student ID'] == student_id]
|
| 14 |
|
| 15 |
if not student_data.empty:
|
|
|
|
| 18 |
else:
|
| 19 |
return "Student ID not found."
|
| 20 |
|
|
|
|
| 21 |
iface = gr.Interface(
|
| 22 |
fn=get_feedback,
|
| 23 |
+
inputs=gr.Textbox(label="Enter Student ID"),
|
| 24 |
+
outputs=gr.Textbox(label="Feedback"),
|
| 25 |
title="Student Feedback System",
|
| 26 |
+
description="Enter a Student ID (1–8) to get their feedback."
|
| 27 |
)
|
| 28 |
|
|
|
|
| 29 |
iface.launch()
|