Update app.py
Browse files62 unmodified lines6364656667686915 unmodified lines8586878889909192939495969798991001011021031041053 unmodified lines10911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514662 unmodified linesprint(f'\nModel Accuracy: {accuracy * 100:.2f}%')# Gradio input components# Use dropdowns for categorical columns based on datasetcategory_options = {col: sorted(df[col].dropna().unique().tolist()) for col in categorical_cols}inputs = []15 unmodified linesexcept Exception as e:return f"Error: {e}"# Interface with Gradiogr.Interface(fn=predict_program,inputs=inputs,outputs="text",title="MHIS Student Program Predictor",description="Enter student academic and philosophical details to predict the most suitable MHIS program.",examples=[[80083, 3.8, "10", "35", "Perennialism"],[20229, 4.2, "2", "95", "Progressivism"]]# ///////////////////////////////////////# Define the comparison datacomparison_data = [["Aspect", "Perennialism", "Progressivism"],["Focus", "Eternal truths, intellectual discipline", "Student experience, real-world relevance"],3 unmodified lines["Key Thinkers", "Robert Hutchins, Mortimer Adler", "John Dewey, William Kilpatrick"]]# Create a Gradio interfacewith gr.Blocks() as demo:gr.Markdown("## 🎓 Perennialism vs Progressivism in Education")gr.Markdown("A comparison of two major educational philosophies.")# Display the table using DataFramegr.DataFrame(value=comparison_data,headers=["Aspect", "Perennialism", "Progressivism"],datatype=["str", "str", "str"],interactive=False,elem_id="comparison-table")# (Alternative: Use HTML for better formatting)# table_html = """# <table border="1" style="width:100%"># <tr><th>Aspect</th><th>Perennialism</th><th>Progressivism</th></tr># <tr><td>Focus</td><td>Eternal truths, intellectual discipline</td><td>Student experience, real-world relevance</td></tr># <tr><td>Curriculum</td><td>Fixed, classic texts (Great Books)</td><td>Flexible, interdisciplinary</td></tr># <tr><td>Teaching Method</td><td>Teacher-centered, lecture-based</td><td>Student-centered, hands-on learning</td></tr># <tr><td>Goal</td><td>Cultivate rational, moral thinkers</td><td>Develop problem-solvers for democracy</td></tr># <tr><td>Key Thinkers</td><td>Robert Hutchins, Mortimer Adler</td><td>John Dewey, William Kilpatrick</td></tr># </table># """# gr.HTML(table_html)demo.launch()# ////////////////////////////////////////).launch()62 unmodified lines63646566676815 unmodified lines848586878889903 unmodified lines94959697989910010110210310410510610710810911011111211311411511611711811912012112212312412562 unmodified linesprint(f'\nModel Accuracy: {accuracy * 100:.2f}%')# Gradio input componentscategory_options = {col: sorted(df[col].dropna().unique().tolist()) for col in categorical_cols}inputs = []15 unmodified linesexcept Exception as e:return f"Error: {e}"# Comparison data for Perennialism vs Progressivismcomparison_data = [["Aspect", "Perennialism", "Progressivism"],["Focus", "Eternal truths, intellectual discipline", "Student experience, real-world relevance"],3 unmodified lines["Key Thinkers", "Robert Hutchins, Mortimer Adler", "John Dewey, William Kilpatrick"]]# Create Gradio interface with tabswith gr.Blocks(title="MHIS Educational Tools") as demo:with gr.Tab("Program Predictor"):gr.Interface(fn=predict_program,inputs=inputs,outputs="text",title="MHIS Student Program Predictor",description="Enter student academic and philosophical details to predict the most suitable MHIS program.",examples=[[80083, 3.8, "10", "35", "Perennialism"],[20229, 4.2, "2", "95", "Progressivism"]])with gr.Tab("Philosophy Comparison"):gr.Markdown("## 🎓 Perennialism vs Progressivism in Education")gr.Markdown("A comparison of two major educational philosophies.")# Display the table using DataFramegr.DataFrame(value=comparison_data,headers=["Aspect", "Perennialism", "Progressivism"],datatype=["str", "str", "str"],interactive=False,elem_id="comparison-table")demo.launch()
app.py+29-50