Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
# Load the CSV file containing the student data
|
| 5 |
+
df = pd.read_csv("student_feedback.csv")
|
| 6 |
+
|
| 7 |
+
def get_feedback(student_id):
|
| 8 |
+
# Check if the Student ID exists in the dataset
|
| 9 |
+
student_data = df[df['Student ID'] == student_id]
|
| 10 |
+
|
| 11 |
+
if not student_data.empty:
|
| 12 |
+
feedback = student_data['Feedback'].values[0]
|
| 13 |
+
return f"Feedback for Student ID {student_id}: {feedback}"
|
| 14 |
+
else:
|
| 15 |
+
return "Student ID not found."
|
| 16 |
+
|
| 17 |
+
# Create the Gradio interface
|
| 18 |
+
iface = gr.Interface(
|
| 19 |
+
fn=get_feedback,
|
| 20 |
+
inputs="text",
|
| 21 |
+
outputs="text",
|
| 22 |
+
title="Student Feedback System",
|
| 23 |
+
description="Enter a Student ID to get the feedback."
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
# Launch the app
|
| 27 |
+
iface.launch()
|