Spaces:
Build error
Build error
File size: 983 Bytes
6bd6950 df95f77 6bd6950 f5cd394 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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()
|