Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,14 +7,14 @@ import gspread
|
|
| 7 |
from oauth2client.service_account import ServiceAccountCredentials
|
| 8 |
from openai import OpenAI
|
| 9 |
|
| 10 |
-
# === Google Sheet
|
| 11 |
def init_gsheet():
|
| 12 |
scope = ["https://spreadsheets.google.com/feeds",
|
| 13 |
"https://www.googleapis.com/auth/drive"]
|
| 14 |
service_account_info = json.loads(os.getenv("GCP_SERVICE_ACCOUNT_JSON"))
|
| 15 |
creds = ServiceAccountCredentials.from_json_keyfile_dict(service_account_info, scope)
|
| 16 |
client = gspread.authorize(creds)
|
| 17 |
-
#
|
| 18 |
sheet = client.open("OneMinuteSummaryScores").sheet1
|
| 19 |
return sheet
|
| 20 |
|
|
@@ -27,7 +27,7 @@ MODEL_NAME = "gpt-5.4-mini-2026-03-17"
|
|
| 27 |
|
| 28 |
INTRO_TEXT = """
|
| 29 |
<div>
|
| 30 |
-
<h1>國防醫學大學 醫學模擬實驗室 - 「One-Minute Summary」考核評分</h1>
|
| 31 |
<h1>National Defense Medical University Medical Simulation Lab - 「One-Minute Summary」</h1>
|
| 32 |
<p>本系統根據 <b>等第制 (A~F)</b> 與七大題項 (總分100分) 對你的總結給出評分與評語。</p>
|
| 33 |
<p>The System is based on <b> ranking A~F</b> and 7 questions (totoal 100) to evaluate your summary</p>
|
|
@@ -35,7 +35,7 @@ INTRO_TEXT = """
|
|
| 35 |
</div>
|
| 36 |
"""
|
| 37 |
|
| 38 |
-
# ===
|
| 39 |
def parse_scores(text: str):
|
| 40 |
total = None
|
| 41 |
m_total = re.search(r"總分[::]\s*(\d+)\s*/\s*100", text)
|
|
@@ -121,7 +121,7 @@ ________________________________________
|
|
| 121 |
共100分
|
| 122 |
學生主要用什麼語言回答你就用什麼語言給分打回饋。
|
| 123 |
________________________________________
|
| 124 |
-
請輸出格式:
|
| 125 |
1. 各項逐條給分與簡評
|
| 126 |
2. 總分 (x/100)
|
| 127 |
3. 等第 (A~F)
|
|
@@ -266,7 +266,7 @@ ________________________________________
|
|
| 266 |
|
| 267 |
6. ACGME Internal Medicine Milestones 2.0 補充能力評估
|
| 268 |
|
| 269 |
-
A. 六大核心能力摘要
|
| 270 |
- Patient Care and Procedural Skills (PC): Level X.X / 5
|
| 271 |
- Medical Knowledge (MK): Level X.X / 5
|
| 272 |
- Systems-Based Practice (SBP): Level X.X / 5
|
|
|
|
| 7 |
from oauth2client.service_account import ServiceAccountCredentials
|
| 8 |
from openai import OpenAI
|
| 9 |
|
| 10 |
+
# === Google Sheet ===
|
| 11 |
def init_gsheet():
|
| 12 |
scope = ["https://spreadsheets.google.com/feeds",
|
| 13 |
"https://www.googleapis.com/auth/drive"]
|
| 14 |
service_account_info = json.loads(os.getenv("GCP_SERVICE_ACCOUNT_JSON"))
|
| 15 |
creds = ServiceAccountCredentials.from_json_keyfile_dict(service_account_info, scope)
|
| 16 |
client = gspread.authorize(creds)
|
| 17 |
+
# Google Sheet
|
| 18 |
sheet = client.open("OneMinuteSummaryScores").sheet1
|
| 19 |
return sheet
|
| 20 |
|
|
|
|
| 27 |
|
| 28 |
INTRO_TEXT = """
|
| 29 |
<div>
|
| 30 |
+
<h1>國防醫學大學 醫學模擬實驗室 - 「One-Minute Summary」考核評分Beta版</h1>
|
| 31 |
<h1>National Defense Medical University Medical Simulation Lab - 「One-Minute Summary」</h1>
|
| 32 |
<p>本系統根據 <b>等第制 (A~F)</b> 與七大題項 (總分100分) 對你的總結給出評分與評語。</p>
|
| 33 |
<p>The System is based on <b> ranking A~F</b> and 7 questions (totoal 100) to evaluate your summary</p>
|
|
|
|
| 35 |
</div>
|
| 36 |
"""
|
| 37 |
|
| 38 |
+
# === Score ===
|
| 39 |
def parse_scores(text: str):
|
| 40 |
total = None
|
| 41 |
m_total = re.search(r"總分[::]\s*(\d+)\s*/\s*100", text)
|
|
|
|
| 121 |
共100分
|
| 122 |
學生主要用什麼語言回答你就用什麼語言給分打回饋。
|
| 123 |
________________________________________
|
| 124 |
+
請輸出格式:(要有一個總分)
|
| 125 |
1. 各項逐條給分與簡評
|
| 126 |
2. 總分 (x/100)
|
| 127 |
3. 等第 (A~F)
|
|
|
|
| 266 |
|
| 267 |
6. ACGME Internal Medicine Milestones 2.0 補充能力評估
|
| 268 |
|
| 269 |
+
A. 六大核心能力摘要 (給出一個百分制的摘要總分)
|
| 270 |
- Patient Care and Procedural Skills (PC): Level X.X / 5
|
| 271 |
- Medical Knowledge (MK): Level X.X / 5
|
| 272 |
- Systems-Based Practice (SBP): Level X.X / 5
|