Update app,py
Browse files
app,py
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
# app.py
|
2 |
import gradio as gr
|
3 |
-
from
|
4 |
|
5 |
-
# 初始化模型
|
6 |
trainer = FinancialFraudTrainer()
|
7 |
-
trainer.
|
|
|
|
|
8 |
|
9 |
-
# Gradio 介面
|
10 |
app = gr.Interface(
|
11 |
fn=trainer.predict_transaction,
|
12 |
inputs=gr.Textbox(lines=3, placeholder="輸入交易簡訊..."),
|
@@ -16,4 +16,4 @@ app = gr.Interface(
|
|
16 |
)
|
17 |
|
18 |
if __name__ == "__main__":
|
19 |
-
app.launch(share=True, debug=True)
|
|
|
1 |
# app.py
|
2 |
import gradio as gr
|
3 |
+
from fraud_detector import FinancialFraudTrainer
|
4 |
|
|
|
5 |
trainer = FinancialFraudTrainer()
|
6 |
+
trainer.load_model() # ✅ 直接從 HF model hub 載入
|
7 |
+
trainer.tokenizer = trainer.tokenizer or trainer.load_model().tokenizer
|
8 |
+
trainer.model.eval()
|
9 |
|
|
|
10 |
app = gr.Interface(
|
11 |
fn=trainer.predict_transaction,
|
12 |
inputs=gr.Textbox(lines=3, placeholder="輸入交易簡訊..."),
|
|
|
16 |
)
|
17 |
|
18 |
if __name__ == "__main__":
|
19 |
+
app.launch(share=True, debug=True)
|