jerrychen428 commited on
Commit
7b44596
·
verified ·
1 Parent(s): 12cc32b

Update app,py

Browse files
Files changed (1) hide show
  1. app,py +5 -5
app,py CHANGED
@@ -1,12 +1,12 @@
1
  # app.py
2
  import gradio as gr
3
- from Fraud_Detection_BERT_grado_6 import FinancialFraudTrainer
4
 
5
- # 初始化模型
6
  trainer = FinancialFraudTrainer()
7
- trainer.load_saved_model()
 
 
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) # ✅ 真正啟動 Gradio App
 
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)