Corin1998 commited on
Commit
fda280c
·
verified ·
1 Parent(s): 188f682

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -0
app.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import gradio as gr
3
+ from es_advanced_evaluator import evaluate_entry_sheet
4
+
5
+
6
+ def evaluate_es(self_pr: str, motivation: str):
7
+ """
8
+ Gradio から呼ばれるラッパー関数。
9
+ self_pr: 自己PR
10
+ motivation: 志望動機(空でもOK)
11
+ """
12
+ if not self_pr.strip() and not motivation.strip():
13
+ return {
14
+ "error": "自己PRか志望動機のいずれかは入力してください。"
15
+ }
16
+
17
+ result = evaluate_entry_sheet(
18
+ self_pr=self_pr,
19
+ motivation=motivation if motivation.strip() else None,
20
+ )
21
+ return result
22
+
23
+
24
+ with gr.Blocks() as demo:
25
+ gr.Markdown(
26
+ """
27
+ # 新卒エントリーシート AI評価デモ(Hugging Face 上で完結)
28
+
29
+ - 日本語感情分析モデル + 多言語ゼロショット分類モデルを用いて、
30
+ ES の **感情・トーン** と **STAR 構造(Situation / Task / Action / Result)** を自動評価します。
31
+ - 出力は JSON 形式なので、そのまま既存パイプラインに組み込み可能です。
32
+ """
33
+ )
34
+
35
+ with gr.Row():
36
+ self_pr_input = gr.Textbox(
37
+ label="自己PR(必須)",
38
+ lines=12,
39
+ placeholder="自己PRを入力してください。",
40
+ )
41
+ motivation_input = gr.Textbox(
42
+ label="志望動機(任意)",
43
+ lines=12,
44
+ placeholder="志望動機があれば入力してください。(空でも可)",
45
+ )
46
+
47
+ btn = gr.Button("AIで評価する")
48
+
49
+ output_json = gr.JSON(
50
+ label="評価結果(JSON)",
51
+ value={},
52
+ )
53
+
54
+ btn.click(
55
+ fn=evaluate_es,
56
+ inputs=[self_pr_input, motivation_input],
57
+ outputs=output_json,
58
+ )
59
+
60
+ if __name__ == "__main__":
61
+ demo.launch()