Spaces:
Sleeping
Sleeping
hy
commited on
Commit
Β·
1ae484c
1
Parent(s):
4ff995f
round
Browse files- aggro_model.py +3 -3
- crossref_model.py +1 -1
- main.py +4 -4
aggro_model.py
CHANGED
|
@@ -200,15 +200,15 @@ def get_aggro_score(title: str) -> dict:
|
|
| 200 |
|
| 201 |
# 5. λ±κΈ νμ
|
| 202 |
if final_score >= 80:
|
| 203 |
-
reason = f"λ§€μ° λμ π΄ (AI: {bert_score:.
|
| 204 |
recommendation = "μ λ©΄ μμ κΆμ₯"
|
| 205 |
|
| 206 |
elif final_score >= 60:
|
| 207 |
-
reason = f"λμ π (AI: {bert_score:.
|
| 208 |
recommendation = "κ³Όμ₯λ νν μμ νμ"
|
| 209 |
|
| 210 |
elif final_score >= 40:
|
| 211 |
-
reason = f"λ³΄ν΅ π‘ (AI: {bert_score:.
|
| 212 |
recommendation = "μΌλΆ νν μ€λ¦½ν κΆμ₯"
|
| 213 |
|
| 214 |
else:
|
|
|
|
| 200 |
|
| 201 |
# 5. λ±κΈ νμ
|
| 202 |
if final_score >= 80:
|
| 203 |
+
reason = f"λ§€μ° λμ π΄ (AI: {bert_score:.2f}μ , κ·μΉ: {rule_score:.0f}μ ,{rule_pattern})"
|
| 204 |
recommendation = "μ λ©΄ μμ κΆμ₯"
|
| 205 |
|
| 206 |
elif final_score >= 60:
|
| 207 |
+
reason = f"λμ π (AI: {bert_score:.2f}μ , κ·μΉ: {rule_score:.0f}μ ,{rule_pattern})"
|
| 208 |
recommendation = "κ³Όμ₯λ νν μμ νμ"
|
| 209 |
|
| 210 |
elif final_score >= 40:
|
| 211 |
+
reason = f"λ³΄ν΅ π‘ (AI: {bert_score:.2f}μ , κ·μΉ: {rule_score:.0f}μ ,{rule_pattern})"
|
| 212 |
recommendation = "μΌλΆ νν μ€λ¦½ν κΆμ₯"
|
| 213 |
|
| 214 |
else:
|
crossref_model.py
CHANGED
|
@@ -157,7 +157,7 @@ def get_crossref_score_and_reason(article_body: str) -> dict:
|
|
| 157 |
recommendation = "κΈ°μ¬μ ν΅μ¬ μ¬μ€κ΄κ³κ° ν μΈλ‘ μ¬μμλ λ€λ£¨μ΄μ§λμ§ νμΈμ΄ νμν©λλ€."
|
| 158 |
|
| 159 |
return {
|
| 160 |
-
"score": max(0, min(1, final_score)),
|
| 161 |
"reason": reason,
|
| 162 |
"recommendation": recommendation,
|
| 163 |
"paired_results": paired_results
|
|
|
|
| 157 |
recommendation = "κΈ°μ¬μ ν΅μ¬ μ¬μ€κ΄κ³κ° ν μΈλ‘ μ¬μμλ λ€λ£¨μ΄μ§λμ§ νμΈμ΄ νμν©λλ€."
|
| 158 |
|
| 159 |
return {
|
| 160 |
+
"score": max(0, min(1, round(final_score,4))),
|
| 161 |
"reason": reason,
|
| 162 |
"recommendation": recommendation,
|
| 163 |
"paired_results": paired_results
|
main.py
CHANGED
|
@@ -98,9 +98,9 @@ def analyze_article(request: ArticleRequest,db: Session = Depends(get_db)):
|
|
| 98 |
)
|
| 99 |
|
| 100 |
# μ΅μ’
μνλ κ³μ°
|
| 101 |
-
w_aggro = 0.
|
| 102 |
-
w_mismatch = 0.
|
| 103 |
-
w_crossref = 0.
|
| 104 |
|
| 105 |
final_score = (real_aggro.score * w_aggro) + \
|
| 106 |
(real_mismatch.score * w_mismatch) + \
|
|
@@ -142,7 +142,7 @@ def analyze_article(request: ArticleRequest,db: Session = Depends(get_db)):
|
|
| 142 |
# ------------------------------------------------
|
| 143 |
# API λͺ
μΈμ(AnalysisResponse) νμμ λ§μΆ°μ λ°ν
|
| 144 |
return AnalysisResponse(
|
| 145 |
-
final_risk_score=round(final_score,
|
| 146 |
final_risk_level=final_level,
|
| 147 |
breakdown={
|
| 148 |
"aggro_score": real_aggro,
|
|
|
|
| 98 |
)
|
| 99 |
|
| 100 |
# μ΅μ’
μνλ κ³μ°
|
| 101 |
+
w_aggro = 0.2
|
| 102 |
+
w_mismatch = 0.3
|
| 103 |
+
w_crossref = 0.5
|
| 104 |
|
| 105 |
final_score = (real_aggro.score * w_aggro) + \
|
| 106 |
(real_mismatch.score * w_mismatch) + \
|
|
|
|
| 142 |
# ------------------------------------------------
|
| 143 |
# API λͺ
μΈμ(AnalysisResponse) νμμ λ§μΆ°μ λ°ν
|
| 144 |
return AnalysisResponse(
|
| 145 |
+
final_risk_score=round(final_score, 4), # μμμ 4μλ¦¬λ‘ λ°μ¬λ¦Ό
|
| 146 |
final_risk_level=final_level,
|
| 147 |
breakdown={
|
| 148 |
"aggro_score": real_aggro,
|