Spaces:
Build error
Build error
Download app.py from fudii0921/student_support: direct link, hf CLI and curl.
- Browser
- Download file 983 Bytes
-
https://huggingface.co/spaces/fudii0921/student_support/resolve/main/app.py
- Command line
-
hf download hf://spaces/fudii0921/student_support/app.py
-
curl -L -o app.py https://huggingface.co/spaces/fudii0921/student_support/resolve/main/app.py
983 Bytes
| import pandas as pd | |
| import gradio as gr | |
| # 支援が必要な児童生徒を抽出する関数 | |
| def extract_support_needed(file): | |
| df = pd.read_csv(file.name) | |
| support_needed = df[df['attendance_rate'] < 80] | |
| def suggest_support(row): | |
| if row['attendance_rate'] < 45: | |
| return '個別指導が必要' | |
| elif row['attendance_rate'] < 55: | |
| return 'カウンセリングを提案' | |
| else: | |
| return '支援不要' | |
| support_needed['support_suggestion'] = support_needed.apply(suggest_support, axis=1) | |
| return support_needed[['student_id', 'student_name', 'attendance_rate', 'support_suggestion']] | |
| # Gradioインターフェースの作成 | |
| interface = gr.Interface( | |
| fn=extract_support_needed, | |
| inputs=gr.File(label="スクリーニングシート(CSVファイル)をアップロード"), | |
| outputs=gr.Dataframe(label="支援が必要な児童生徒") | |
| ) | |
| # インターフェースの起動 | |
| interface.launch() | |