Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Test script for the KPI Correlation Analysis Gradio App | |
| This script demonstrates how to run the Gradio app and provides usage instructions. | |
| """ | |
| import os | |
| import sys | |
| def main(): | |
| print("=== KPI Correlation Analysis Gradio App Test ===\n") | |
| # Check if required files exist | |
| script_dir = os.path.dirname(os.path.abspath(__file__)) | |
| app_file = os.path.join(script_dir, 'kpi_correlation_app.py') | |
| scores_file = os.path.join(script_dir, 'lenovo-scores-0603.csv') | |
| print("Checking required files...") | |
| if not os.path.exists(app_file): | |
| print(f"β Error: Gradio app file not found: {app_file}") | |
| sys.exit(1) | |
| else: | |
| print(f"β Gradio app file found: {app_file}") | |
| if not os.path.exists(scores_file): | |
| print(f"β Error: Scores file not found: {scores_file}") | |
| print(" Please ensure lenovo-scores-0603.csv is in the same directory as the app") | |
| sys.exit(1) | |
| else: | |
| print(f"β Scores file found: {scores_file}") | |
| print("\n=== Instructions for Running the App ===") | |
| print("1. Run the Gradio app:") | |
| print(f" python3 {app_file}") | |
| print("\n2. The app will start and display a URL (usually http://127.0.0.1:7860)") | |
| print("\n3. Open the URL in your web browser") | |
| print("\n4. Upload a KPI file (CSV or Excel format) using the file upload button") | |
| print("\n5. Click 'Analyze Correlations' to see the results") | |
| print("\nThe app will display:") | |
| print("- Data quality report showing matched records") | |
| print("- Correlation analysis results (Pearson and Spearman)") | |
| print("- Four scatter plots showing correlations:") | |
| print(" - AC: Problem Score vs FY23/24 IPM") | |
| print(" - AD: Problem Score vs FY24/25 IPM") | |
| print(" - BC: Ability Score vs FY23/24 IPM") | |
| print(" - BD: Ability Score vs FY24/25 IPM") | |
| print("\n=== Example KPI Files ===") | |
| print("You can test with these files:") | |
| print("- ../../data/lenovo_kpi.csv") | |
| print("- test_kpi.csv") | |
| print("- ../../data/Copy of θζ³ kpi copy.xlsx") | |
| print("\n=== Starting the Gradio App ===") | |
| print("To start the app now, press Enter...") | |
| input() | |
| # Run the Gradio app | |
| os.system(f"python3 {app_file}") | |
| if __name__ == "__main__": | |
| main() |