fudii0921 commited on
Commit
a565bb4
·
verified ·
1 Parent(s): 5562c31

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -49
app.py CHANGED
@@ -57,57 +57,60 @@ def extract_scores(state):
57
  def evaluate_responses(state, email, programming, debugging, problem, problem_solving, project_experience, role, learning, learnt_skills):
58
  state["final_email"] = email
59
 
60
- # レコード作成
61
- records = f"""
62
- ✨プログラミング言語について: {programming}
63
- ✨デバッグ方法について: {debugging}
64
- ✨最近解決した技術的な課題: {problem}
65
- ✨プロジェクト問題解決方法について: {problem_solving}
66
- ✨プロジェクト経験について: {project_experience}
67
- ✨チームでの役割について: {role}
68
- ✨新しい技術への学習意欲について: {learning}
69
- ✨最近学んだ技術や知識について: {learnt_skills}
70
- """
71
- co = cohere.ClientV2(api_key=os.environ.get("COHERE_API_KEY"))
72
- res = co.chat(
73
- model="command-a-03-2025",
74
- messages=[
75
- {
76
- "role": "user",
77
- "content": f"""
78
- {records}を「基準」に基づいて各項目の合計スコアを10段階で割り振って評価してください。答えは、必ず、「形式」で合計スコアのみを返してください。
79
- 「基準」=価基準とポイント配分
80
- 技術的な理解 (30%): 例えばプログラミング言語の知識やデバッグ能力を考慮。コード品質や問題解決能力が評価対象。
81
- 問題解決能力 (25%): 技術的課題への対応スキルやアプローチ方法をチェック。現実的かつ効率的な解決策を出せるかどうか。
82
- 実務経験 (20%): 過去のプロジェクト経験の内容や規模。実際の成果や役割が評価される。
83
- 学習意欲 (15%): 新しい技術をどれだけ積極的に学び、適応しているか。最近学んだ知識がアピールポイント!
84
- ソフトスキル (10%): チームワークやコミュニケーション能力。エンジニアの柔軟性や協力姿勢を評価。
85
- 「形式」= {{
86
- "技術的な理解": 9,
87
- "問題解決能力": 8.5,
88
- "実務経験": 8,
89
- "学習意欲": 9.5,
90
- "ソフトスキル": 8.5,
91
- "合計スコア": 8.63,
92
- "スキルレベル": "Expert",
93
- "説明": "技術力や問題解決能力、学習意欲が高くバランスの良いスキルセットを持っている。"
94
- }}
95
- """,
96
- }
97
- ],
98
- )
99
-
100
- cleaned_string = res.message.content[0].text.replace("```json", "").replace("```", "").strip()
 
101
 
102
- data = json.loads(cleaned_string)
103
- #data = json.loads(res.message.content[0].text)
104
- comments = "\n".join([f"{key}: {value}" for key, value in data.items()])
105
- scores = [f"{key}: {value}" for key, value in data.items()]
106
 
107
- state["final_comment"] = comments
108
- state["final_score"] = scores
109
 
110
- return records, comments
 
 
111
 
112
 
113
  # Gradio Blocksの構築
@@ -118,7 +121,7 @@ with gr.Blocks(css="footer {visibility: hidden;} #custom_button {width: 400px; m
118
  "final_score": [],
119
  })
120
 
121
- gr.Markdown("# エンジニア・スキル評価")
122
  gr.Markdown("エンジニアスキルを簡易評価するアプリです!")
123
 
124
  with gr.Tab("エンジニアスキル評価質問フォーム"):
 
57
  def evaluate_responses(state, email, programming, debugging, problem, problem_solving, project_experience, role, learning, learnt_skills):
58
  state["final_email"] = email
59
 
60
+ if (email != "" and programming != "" and debugging != "" and problem != "" and problem_solving != "" and project_experience != "" and role != "" and learning != "" and learnt_skills != ""):
61
+ # レコード作成
62
+ records = f"""
63
+ ✨プログラミング言語について: {programming}
64
+ ✨デバッグ方法について: {debugging}
65
+ ✨最近解決した技術的な課題: {problem}
66
+ ✨プロジェクト問題解決方法について: {problem_solving}
67
+ ✨プロジェクト経験について: {project_experience}
68
+ ✨チームでの役割について: {role}
69
+ ✨新しい技術への学習意欲について: {learning}
70
+ ✨最近学んだ技術や知識について: {learnt_skills}
71
+ """
72
+ co = cohere.ClientV2(api_key=os.environ.get("COHERE_API_KEY"))
73
+ res = co.chat(
74
+ model="command-a-03-2025",
75
+ messages=[
76
+ {
77
+ "role": "user",
78
+ "content": f"""
79
+ {records}を「基準」に基づいて各項目の合計スコアを10段階で割り振って評価してください。答えは、必ず、「形式」で合計スコアのみを返してください。
80
+ 「基準」=価基準とポイント配分
81
+ 技術的な理解 (30%): 例えばプログラミング言語の知識やデバッグ能力を考慮。コード品質や問題解決能力が評価対象。
82
+ 問題解決能力 (25%): 技術的課題への対応スキルやアプローチ方法をチェック。現実的かつ効率的な解決策を出せるかどうか。
83
+ 実務経験 (20%): 過去のプロジェクト経験の内容や規模。実際の成果や役割が評価される。
84
+ 学習意欲 (15%): 新しい技術をどれだけ積極的に学び、適応しているか。最近学んだ知識がアピールポイント!
85
+ ソフトスキル (10%): チームワークやコミュニケーション能力。エンジニアの柔軟性や協力姿勢を評価。
86
+ 「形式」= {{
87
+ "技術的な理解": 9,
88
+ "問題解決能力": 8.5,
89
+ "実務経験": 8,
90
+ "学習意欲": 9.5,
91
+ "ソフトスキル": 8.5,
92
+ "合計スコア": 8.63,
93
+ "スキルレベル": "Expert",
94
+ "説明": "技術力や問題解決能力、学習意欲が高くバランスの良いスキルセットを持っている。"
95
+ }}
96
+ """,
97
+ }
98
+ ],
99
+ )
100
+
101
+ cleaned_string = res.message.content[0].text.replace("```json", "").replace("```", "").strip()
102
 
103
+ data = json.loads(cleaned_string)
104
+ #data = json.loads(res.message.content[0].text)
105
+ comments = "\n".join([f"{key}: {value}" for key, value in data.items()])
106
+ scores = [f"{key}: {value}" for key, value in data.items()]
107
 
108
+ state["final_comment"] = comments
109
+ state["final_score"] = scores
110
 
111
+ return records, comments
112
+ else:
113
+ return "入力が正しくありません。","None"
114
 
115
 
116
  # Gradio Blocksの構築
 
121
  "final_score": [],
122
  })
123
 
124
+ gr.Markdown("# エンジニアスキル評価")
125
  gr.Markdown("エンジニアスキルを簡易評価するアプリです!")
126
 
127
  with gr.Tab("エンジニアスキル評価質問フォーム"):