Create app,py
Browse files
app,py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# app.py
|
2 |
+
from Fraud_Detection_BERT_grado_6 import FinancialFraudTrainer
|
3 |
+
|
4 |
+
trainer = FinancialFraudTrainer()
|
5 |
+
trainer.load_saved_model()
|
6 |
+
|
7 |
+
# 建立 Gradio 介面
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
demo = gr.Interface(
|
11 |
+
fn=self.predict_transaction, # 指定推論函式
|
12 |
+
inputs=gr.Textbox(lines=3, placeholder="輸入交易簡訊..."),
|
13 |
+
outputs="text",
|
14 |
+
title="💳 中英文詐騙簡訊判斷器",
|
15 |
+
description="輸入交易相關訊息,判斷是否為詐騙訊息(支援中文與英文)。"
|
16 |
+
).launch(share=True, debug=True) # 如果防毒軟體會報錯,請將share=True, debug=True改為share=False
|
17 |
+
|
18 |
+
if __name__ == "__main__":
|
19 |
+
demo..launch(share=True, debug=True) # 如果防毒軟體會報錯,請將share=True, debug=True改為share=False
|