kino / main.py
barathm111's picture
Upload 3 files
d29a8b2 verified
import gradio as gr
from performance_analyzer import CollegePerformanceAnalyzer
def run_performance_analysis(seed: int = None, use_ai_insights: bool = True):
"""
Main function to orchestrate college performance analysis.
Args:
seed (int, optional): Random seed for reproducible results
use_ai_insights (bool): Toggle AI-generated strategic insights
Returns:
Comprehensive performance analysis report
"""
# Initialize performance analyzer
analyzer = CollegePerformanceAnalyzer()
# Generate performance scores
parameters = analyzer.generate_performance_scores(seed)
# Calculate comprehensive metrics
analysis_results = analyzer.calculate_weighted_metrics(parameters)
# Generate feedback based on user preference
ai_feedback = (
analyzer.generate_ai_feedback(analysis_results)
if use_ai_insights
else analyzer._generate_manual_feedback(analysis_results)
)
# Combine performance report with strategic insights
report = f"""
# πŸŽ“ College Performance Analysis Report
## Performance Metrics
{' '.join([
f"**{details['full_name']}**: {details['score']}/100 "
for param, details in analysis_results['parameters'].items()
])}
## Overall Performance
- **Total Weighted Score**: {analysis_results['total_weighted_score']:.2f}
- **Predicted NIRF Rank**: {analysis_results['nirf_rank']}
- **Institutional Rating**: {analysis_results['overall_rating']}/5
## Strategic Insights
{ai_feedback}
"""
return report
def create_gradio_interface():
"""
Create interactive Gradio web interface for performance analysis.
"""
iface = gr.Interface(
fn=run_performance_analysis,
inputs=[
gr.Number(label="Random Seed (Optional)", precision=0, optional=True),
gr.Checkbox(label="Generate AI Insights", value=True)
],
outputs=gr.Markdown(label="Performance Analysis Report"),
title="🏫 College Performance Analyzer",
description="Generate comprehensive performance insights with optional AI-powered strategic analysis.",
theme="default"
)
return iface
if __name__ == "__main__":
interface = create_gradio_interface()
interface.launch()