Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import io
|
| 2 |
import pandas as pd
|
| 3 |
import numpy as np
|
| 4 |
import gradio as gr
|
|
@@ -19,7 +18,6 @@ def process_file(file_obj):
|
|
| 19 |
# Clean
|
| 20 |
df = df.dropna(how="all")
|
| 21 |
|
| 22 |
-
# Check required columns
|
| 23 |
required = {"CourseName","NPS","CompletionRate","LearnerSatisfaction","ContentQuality"}
|
| 24 |
if not required.issubset(df.columns):
|
| 25 |
return "Dataset missing expected columns (NPS, CompletionRate, etc.)", None, None
|
|
@@ -35,12 +33,17 @@ def process_file(file_obj):
|
|
| 35 |
heat = px.imshow(df[["NPS","CompletionRate","LearnerSatisfaction","ContentQuality"]].T,
|
| 36 |
x=df["CourseName"], aspect="auto", title="Metrics Heatmap")
|
| 37 |
|
| 38 |
-
return df, bar, heat
|
| 39 |
|
| 40 |
demo = gr.Interface(
|
| 41 |
fn=process_file,
|
| 42 |
inputs=gr.File(label="Upload CSV/XLSX"),
|
| 43 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
title="Course Quality Tracker"
|
| 45 |
)
|
| 46 |
|
|
|
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
import numpy as np
|
| 3 |
import gradio as gr
|
|
|
|
| 18 |
# Clean
|
| 19 |
df = df.dropna(how="all")
|
| 20 |
|
|
|
|
| 21 |
required = {"CourseName","NPS","CompletionRate","LearnerSatisfaction","ContentQuality"}
|
| 22 |
if not required.issubset(df.columns):
|
| 23 |
return "Dataset missing expected columns (NPS, CompletionRate, etc.)", None, None
|
|
|
|
| 33 |
heat = px.imshow(df[["NPS","CompletionRate","LearnerSatisfaction","ContentQuality"]].T,
|
| 34 |
x=df["CourseName"], aspect="auto", title="Metrics Heatmap")
|
| 35 |
|
| 36 |
+
return "Dataset processed successfully!", df, bar, heat
|
| 37 |
|
| 38 |
demo = gr.Interface(
|
| 39 |
fn=process_file,
|
| 40 |
inputs=gr.File(label="Upload CSV/XLSX"),
|
| 41 |
+
outputs=[
|
| 42 |
+
gr.Textbox(label="Status"), # for messages
|
| 43 |
+
gr.Dataframe(label="Cleaned Data"),
|
| 44 |
+
gr.Plot(label="Quality Score Bar"),
|
| 45 |
+
gr.Plot(label="Metrics Heatmap")
|
| 46 |
+
],
|
| 47 |
title="Course Quality Tracker"
|
| 48 |
)
|
| 49 |
|