|
import gradio as gr |
|
import joblib |
|
from huggingface_hub import hf_hub_download |
|
import xgboost as xgb |
|
import numpy as np |
|
|
|
|
|
model_path = hf_hub_download(repo_id="YDluffy/lottery_prediction", filename="lottery_xgboost_model.json") |
|
model = xgb.XGBRegressor() |
|
model.load_model(model_path) |
|
|
|
|
|
def predict_lottery(year, period, num1, num2, num3, num4, num5, num6, special): |
|
features = np.array([[year, period, num1, num2, num3, num4, num5, num6, special]]) |
|
prediction = model.predict(features) |
|
return prediction |
|
|
|
|
|
iface = gr.Interface( |
|
fn=predict_lottery, |
|
inputs=[ |
|
gr.Number(label="年份"), gr.Number(label="期数"), |
|
gr.Number(label="号码1"), gr.Number(label="号码2"), gr.Number(label="号码3"), |
|
gr.Number(label="号码4"), gr.Number(label="号码5"), gr.Number(label="号码6"), |
|
gr.Number(label="特别号码") |
|
], |
|
outputs="text", |
|
title="六合彩预测模型", |
|
description="输入期号和历史开奖号码,预测下一期开奖" |
|
) |
|
|
|
iface.launch() |
|
|