Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
7 |
-
model_path = hf_hub_download(repo_id="YDluffy/
|
8 |
-
model =
|
|
|
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
|
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=[
|