YDluffy commited on
Commit
4b0bb56
·
verified ·
1 Parent(s): 2db7de7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,11 +1,13 @@
1
  import gradio as gr
2
  import joblib
3
  from huggingface_hub import hf_hub_download
 
4
  import numpy as np
5
 
6
- # 从 Hugging Face 下载模型
7
- model_path = hf_hub_download(repo_id="YDluffy/lottery_predictor_model", filename="lottery_predictor_model.pkl")
8
- model = joblib.load(model_path)
 
9
 
10
  # 预测函数
11
  def predict_lottery(year, period, num1, num2, num3, num4, num5, num6, special):
@@ -13,7 +15,7 @@ def predict_lottery(year, period, num1, num2, num3, num4, num5, num6, special):
13
  prediction = model.predict(features)
14
  return prediction
15
 
16
- # Gradio Web 界面
17
  iface = gr.Interface(
18
  fn=predict_lottery,
19
  inputs=[
 
1
  import gradio as gr
2
  import joblib
3
  from huggingface_hub import hf_hub_download
4
+ import xgboost as xgb
5
  import numpy as np
6
 
7
+ # 下载并加载模型
8
+ model_path = hf_hub_download(repo_id="YDluffy/lottery_prediction", filename="lottery_xgboost_model.json")
9
+ model = xgb.XGBRegressor()
10
+ model.load_model(model_path)
11
 
12
  # 预测函数
13
  def predict_lottery(year, period, num1, num2, num3, num4, num5, num6, special):
 
15
  prediction = model.predict(features)
16
  return prediction
17
 
18
+ # 创建 Gradio 界面
19
  iface = gr.Interface(
20
  fn=predict_lottery,
21
  inputs=[